I need to construct a VB6.0 ocx that will be used as a plugin for some external VB6.0 applications
This ocx contains several sub procedures that are supposed to work as event-handlers for some of the external events (External to ocx).
The problem is, the users who use this ocx will only call one of my ocx sub procedures once and only once. Question is , how do i bind all my sub-proc/functions to their respective external events upon this one time initialization so that my procedures will get called when their events fire?
I managed to do this within the external app itself, but not when i ported these codes to OCX and use it as plugin in an external vb program
Let say this is the original event handler in the external vb app:
Private Sub someExternalControl1_someEvent(someParameter as boolean)
MsgBox ("The original event handler")
End Sub
and in that vb app if i do:
dim withevents aaa as someExternalControl
set aaa = someExternalControl1
then this custom event handler will also be called everytime the event fires along with the original event handler as stated above
Private Sub aaa_someEvent(someParameter as boolean)
MsgBox ("The custom event handler")
End Sub
but i couldn't make the same when i put this in OCX. Because i couldn't do:
Public WithEvents ocxMyPlugin As VBControlExtender
...
Set ocxMyPlugin = Controls.Add("myprogID.usercontrolname", "somename", Me)
Set ocxMyPlugin.object.someExternalControl2 = someExternalControl ' this will raise error