I have a DLL created with PBDLL 6.
I am using VB6 to access functions in the DLL.
If have the following in the DLL.
DECLARE FUNCTION AppCallBack(EventID AS LONG, TheData AS LONG) AS LONG
FUNCTION WITSSetEventHandler(BYVAL ConnHandle AS LONG, BYVAL CallBackAddress AS DWORD) EXPORT AS LONG
LOCAL Answer AS LONG
LOCAL EventId AS LONG
LOCAL Msg AS STRING
Msg = "This is a test"
EventId = 2
CALL DWORD CallBackAddress USING AppCallBack(EventId, STRPTR(Msg)) TO Answer
In VB I have:
Answer = WITSSETEVENTHANDLER(1, AddressOf WITSCallBack)
Public Function WITSCallBack(EventId As Long, msg As String) As Long
MsgBox "Message received" <= This message box comes up
MsgBox "EventID = " + Str$(EventId) <= This message box comes up with correct value
MsgBox msg, , Str$(EventId) <= This message box displays ???????
WITSCallBack = 0
End Function
I have tried every variation I can think of.
Pass as a string
pass as an asciiz
pass as a dword
pass as a long
pass byval
pass byref
The closest I can get is to declare the message as a long
and then pass vb a pointer to the string.
It does not display the message but it also does not GPF.
I need an answer really quick.
Any help would be tremendously appreciated.
Thanks
Ben Clark
[email protected]
------------------
I am using VB6 to access functions in the DLL.
If have the following in the DLL.
DECLARE FUNCTION AppCallBack(EventID AS LONG, TheData AS LONG) AS LONG
FUNCTION WITSSetEventHandler(BYVAL ConnHandle AS LONG, BYVAL CallBackAddress AS DWORD) EXPORT AS LONG
LOCAL Answer AS LONG
LOCAL EventId AS LONG
LOCAL Msg AS STRING
Msg = "This is a test"
EventId = 2
CALL DWORD CallBackAddress USING AppCallBack(EventId, STRPTR(Msg)) TO Answer
In VB I have:
Answer = WITSSETEVENTHANDLER(1, AddressOf WITSCallBack)
Public Function WITSCallBack(EventId As Long, msg As String) As Long
MsgBox "Message received" <= This message box comes up
MsgBox "EventID = " + Str$(EventId) <= This message box comes up with correct value
MsgBox msg, , Str$(EventId) <= This message box displays ???????
WITSCallBack = 0
End Function
I have tried every variation I can think of.
Pass as a string
pass as an asciiz
pass as a dword
pass as a long
pass byval
pass byref
The closest I can get is to declare the message as a long
and then pass vb a pointer to the string.
It does not display the message but it also does not GPF.
I need an answer really quick.
Any help would be tremendously appreciated.
Thanks
Ben Clark
[email protected]
------------------
Comment