Results 1 to 5 of 5

Thread: withevents

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 1999
    Location
    Fremont, Ca, 94538
    Posts
    40

    Lightbulb

    Hey, I created an ActiveX DLL, and now i want to use it. I use withevents to instantiate an instance of it, like:

    private withevents mydll as thedll.substuff

    now how do i go and create an array of it? like create more than 1 instance of 'substuff'?

    thanks in advance.

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Instead of instancing the DLL through code everytime you want to use it, why not set its "Instancing" property to "6-GlobalMultiUse" and then goto "Project" - "References" and select your DLL.

    This way you can call it just like any other function in VB.

    Say your DLL has a function in it called "DogYears" and it returns a long.

    The DLL Code:
    Code:
    Function DogYears(YourAge) as Long
    DogYears = YourAge * 7
    End Function
    After you've set a reference to your DLL Call it from your project as follows:

    Code:
    Private Sub Command1_Click()
    MsgBox DogYears(21) 'Returns 147 (as long)
    End Sub
    Just thought this might be easier for you, after I discovered how to I never did it the other way again.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 1999
    Location
    Fremont, Ca, 94538
    Posts
    40
    How about the events?? The main concern is the events.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Sorry!

    You can't create an array when your using the WithEvents keyword.

  5. #5
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    yer best bet is to create a sort of linked list that can carry events down a chain of wrapper objects, then have this all contained in a container class, similar to how VB collections work. It's not all that easy tho

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width