Sign in to follow this  
Structural

VB6: Callback functions - calling function pointers from VB6

Recommended Posts

I need to call a function through a functionpointer from within VB6, without the intervention of a DLL written in C. Is this possible? What I have now:
public callBack as long
public callBackInterval as long




Public Function setCallBack(functionPtr As Long, Optional interval As Long = 100) As Long
   callBack = functionPtr
   callBackInterval = interval
End Function

' setting callback
setCallBack addressOf myCallBackFunction


' Calling the callback somewhere else in the code
Call callBack ' ERROR "expected procedure, not variable"

An error is generated when trying to call the function throught the pointer saying "Expected procedure, not variable". Can I cast/convert this variable to keep VB6 quiet? Is it even possible to do this in VB6? TY

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this