Hi guys,

i have a dll coded in asm, and i am using VB to call a function in it. One of the parameters i pass to the dll function is a pointer to a callback function in one of the VB modules. I am successfully calling this callback with the following:



.IF ptrCallback
mov eax, offset HelloMsg
push eax
call [ptrCallback]
pop eax
.ENDIF


the VB callback function is declared as receiving a string byval:



Public Function Callback(ByVal sMessage As String)
MsgBox sMessage
End Function


however, when i MsgBox the string from VB, i get an empty message box, and when the function returns back to the dll i get an illegal access error, and VB shuts down.

The question is: how is VB expecting to receive the string? Should i be doing any stack cleanup after the "call "? What difference does it make to the asm routine calling the callback if i make the callback a Sub instead of a function?

Thanks!

Follow up:
After some more messing around, i find that the VB function is not actually receiving the values i push onto the stack before calling it. How am i supposed to pass stuff to it?
Posted on 2001-11-27 07:10:32 by sluggy
sluggy,

Try this link:

http://www.geocities.com/emami_s/assembly.html

I used it a long time ago and found it usefull!

farrier
Posted on 2001-11-27 15:00:50 by farrier