Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing a DLL's events

Status
Not open for further replies.

elziko

Programmer
Nov 7, 2000
486
GB
I have a DLL which contains a form. This form has buttons on it which have some sort of click event.

What I want to do is fire off this click event from outside the DLL.

Is this possible?

Thanks

elziko
 
Yes, this is possible. You will need to create a Class Wrapper inside of your DLL to contain the FORM. The Form and the controls on it will raise events to the Class Wrapper. The Class Wrapper, in turn, will raise events to your client application. When you declare the class wrapper object in the code that is using the DLL, you need to declare it WithEvents and then any events that your class wrapper has passed along will be visible to the client application. - Jeff Marler B-)
 
Is the "DLL" an ActiveX DLL. If so, look at "With Events".
Code:
To handle the PercentDone event of a Widget, place the following code in the Declarations section of Form1:

Option Explicit
Private WithEvents mWidget As Widget
,,,,
Private Sub mWidget_PercentDone(ByVal Percent As _
Single, Cancel As Boolean)
   ...
End Sub
 
John,
Normally, what you said is correct, but he has a form inside of the DLL that he is instantiating . . . WithEvents will not reveal the form events when it is inside of another DLL which is what the Class Wrapper is for. The Class Wrapper Ccommunicates the forms events to a public COM interface.
- Jeff Marler B-)
 
Yeah,
I realized that right after submitting and heading off to work. I "read" too much from the title, "Accessing a DLL's events", which upon more considered reflection of the actual text would have been read as "Accessing a Control's Events inside a DLL".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top