Setting a call back function to a function inside a control 
Author Message
 Setting a call back function to a function inside a control


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

Sun, 01 Apr 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. How to call VBScript functions inside WebBrowser control?

2. Local function/sub inside function/sub

3. HOWTO: Call JavaScript function from inside a VBScript Sub

4. calling comobjects from a function written in vbscript inside asp

5. Can I create call-back functions in VB?

6. call-back functions in a fortran dll

7. Multi-threading Problem with a call back function

8. Need help with ActiveX EXE - Call back function

9. functions calling other functions

10. Calling Function in CBF from Toolbar via a Public Function

11. eval function? how to call dynamic function name

12. Calling a sub or function using a variable through another sub or function


Powered by phpBB® Forum Software