this is the callback function:
typedef void(__stdcall * T_OperationMethod) (LONG32 Id, LONG32 operation, LONG32 result, LONG32 summary, void *data) typedef void(__stdcall * T_StaMethod) (LONG32 status, LONG32 result, LONG32 summary, void *details) typedef void(__stdcall * T_InterMethod) (LONG32 Id, LONG32 operation, LONG32 summary, void *data)
this is the API command with the callback function as parameter:
typedef signed long INT32 typedef INT32 T_Result DLL_API T_Result CALLTYPE test_Open(T_OperationMethod operation, T_StaMethod status, T_InterMethod intermediate )
[in] operation Callback function for operation event.
[in] status Callback function for status event.
[in] intermediate Callback function for intermediate event.
What i have done in Vb6 is as follows to equivalent the code above for enable me to call the API and also the callback function:
Function that i created for the api to callback:
Public Sub onOperation(ByVal Id&, ByVal operation&, ByVal result&, ByVal summary&, ByRef data As Long) Public Sub onStatus(ByVal status&, ByVal result&, ByVal summary&, ByRef details As Long) Public Sub onIntermediate(ByVal Id&, ByVal operation&, ByVal summary&, ByRef data As Long)
API command Delcaration equivalent to the C:
Public Declare Function test_Open Lib "testCtlW32.dll" (ByVal operation As Long, ByVal status As Long, ByVal intermediate As Long) As Long
Passing address of the callback function:
Dim lngReturn as long lngReturn = bnr_Open(AddressOf onOperation, AddressOf onStatus, AddressOf onIntermediate)
However, I encounter error as the application crashed and it seem like my callback function is not working at all where by the function parameter or the function is not been called. Is there anything that i missed out?or the implementation of callback function i had done is wrong?
I had try to change the data type and also byval/byref change but it seem nothing is working.
When the application crashed the event viewer put this description as follows:
Faulting application project1.exe, version 18.104.22.168, faulting module msvbvm60.dll, version 22.214.171.124, fault address 0x000e47f2.
Thank You in advance.