Callback - Provide a C callable callback

Top  Previous  Next



<nAddress> := Callback( <cbCallbackBlock>, [<nCallConvention>], [<cErrorInformation>] )






Codeblock to be executed when a call to the returned address takes place.




Calling convention to be used for the callback. See for supported conventions. Default is CALLBACK_CALLCONVENTION_STDCALL.




A string holding the information to be displayed if an error occurs during installation of the callback.


Return value

A LONG value representing an address that can be called like a C function.


A call to the address returned by Callback will lead to the execution of <cbCallbackBlock>. C parameters passed in by the caller are passed on as LONG values to <cbCallbackBlock>. <cbCallbackBlock> must receive exactly the number of parameters that are passed and the calling convention specified in <nCallConvention> must match the calling convention expected by the caller. If the callback cannot be installed in memory, a SysError is thrown. In this case the string passed in <cErrorInformation> is shown as error text. If you don't want an error to be thrown in this case, use RequestCallback. A callback installed with Callback should be released with ReleaseCallback if it is not used any longer to free resources.


For more details about callbacks turn to Callbacks.




Calls and callbacks

Quick Info

Library: cckptcor.lib / cckptcor.dll


See also

RequestCallback, ReleaseCallback








LOCAL callbackAddress


* Create a callback for a function to be called via CallAddress

callbackAddress := Callback({|a,b,c|MyCallback(a,b,c)},CALLBACK_CALLCONVENTION_STDCALL,;

                           "Test Callback")


* Call the function via its address passing some test parameters

? CallAddress(callbackAddress,1,2,3)





* Function to be called via CallAddress

STATIC FUNCTION MyCallback(a,b,c)


* Display the parameters passed

? a,b,c


* Return the sum

RETURN a+b+c