Article ID: 184332
Article Last Modified on 3/21/2005
-and-
-and-
Private mycontrol As passcontrol.UserControl1
Friend Sub passSelf(obj As passcontrol.UserControl1)
Set mycontrol = obj
mycontrol.SayHello
End Sub
Private Sub Class_Terminate()
Set mycontrol = Nothing
End Sub
Private myclass As New passcontrol.Class1
Private Sub UserControl_Initialize()
myclass.passSelf Me
End Sub
Friend Sub SayHello()
MsgBox "Hello!"
End Sub
Private Declare Sub CopyMemory _
Lib "kernel32" Alias "RtlMoveMemory" _
(pDest As Any, _
pSrc As Any, _
ByVal ByteLen As Long)
Private mycontrol As passcontrol.UserControl1
Friend Sub passSelf(ByVal ptrobj As Long)
CopyMemory mycontrol, ptrobj, 4
mycontrol.SayHello
End Sub
Private Sub Class_Terminate()
Set mycontrol = Nothing
End Sub
In the UserControl, substitute the following code:
Private myclass As New passcontrol.Class1
Private Sub UserControl_Initialize()
myclass.passSelf ObjPtr(Me)
End Sub
Friend Sub SayHello()
MsgBox "Hello!"
End Sub
Additional query words: VC++ C++ user control activex ocx
Keywords: kbbug kbfix kbcrt kbctrlcreate KB184332