Click to See Complete Forum and Search --> : Equivalent for 'addressof' in eVB ?


MRao
July 17th, 2002, 02:20 PM
Hi,

I am new to this forum and to eVb/eVC development. I am having difficulty with implementing the following code in eVb

I have a callback function in an eVC dll for eg:

long LIBRARY_EXPORT SetCallbackProcAddr(long lProcAddress)
{
long Result = 0;

// Set the Proc-Address for the notify-func of the caller app.
DataReadNotify = (TDataReadNotify)lProcAddress;

if (DataReadNotify != NULL) Result = 1;
return Result;
};


I am trying to set the address of this callback function in an eVB application in the following manner :

Private Sub Form_OKClick()
' Send Address-Pointer Information to the DLL
Call SetCallbackProcAddr(AddressOf DataReadNotify)

End Sub

Public Sub DataReadNotify(ByVal lDBData As Long)

sDBData = CStr(lDBData)
sMessage = "DBData from DLL is: " & sDBData
MsgBox sMessage, vbOKOnly + vbInformation, "Sample App"
' Set Wait to 0, so that WinMain can go further.
iWait = 0

End Sub


The callback needs to be triggered in the following code from eVC

DWORD CallApp(LPVOID lpParameter)
{
long lDBData;

lDBData = 123;

// Notify the caller app via CB-function.
if (DataReadNotify != NULL) DataReadNotify(lDBData);

return 0;
};


The problem is that the keyword 'Addressof' is not supported in eVb (addressof is supported in VB) and hence I am stuck.

So can anyone give me ideas on how I could get around this problem.

Thanks a ton

MRao