
Setting a call back function to a function inside a control
Hi:
i'm using the Timer API functions to provide timer functionality
for a control i am creating.
the SetTimer API requires that you declare a function inside
a .BAS module for call back purposes.
everything works great so far....
however, i would like to set the call back function to a function
inside the control itself as opposed to a function in a .BAS
module. but when i do this ugly things happen.
i even tried this little snippet to call a function inside a .CTL
control file.
Public Const GWL_USERDATA = (-21)
Dim ctlShadowControl As MyControl
Dim ptrObject As Long
Public Sub TimerFunc1(hWnd As Long, uMsg As Long, _
idEvent As Long, dwTime As Long)
On Error Resume Next
ptrObject = GetWindowLong(hWnd, GWL_USERDATA)
CopyMemory ctlShadowControl, ptrObject, 4
SubWndProc = ctlShadowControl.TimerEvent()
CopyMemory ctlShadowControl, 0&, 4
Set ctlShadowControl = Nothing
End Sub
but, alas this doesn't work either!
i got that last code snippet from a control subclassing example.
and help would be appreciated...
thanks in advance
D. P. Mazeall