Thank you Jason
------------------
-Greg
Announcement
Collapse
No announcement yet.
PB Callingback > VB
Collapse
X
-
Guest repliedGreg,
I remember many discussions about having a dll function callback within
VB, and I remember the outcome to always cause a GPF.
To solve your proposed problem:
1) Make the DLL w/ exported functions in PB (I'm assuming that one of these functions will take a function pointer to the callback function).
2) Make a BAS file in VB w/ a function that matches the signature of the defined callback function.
3) When you want to set up the callback in VB, pass in the function pointer to your exported DLL function using the AddressOf keyword.
You're done. Note that you cannot call back to a class method, which means that the callback function must have a reference to the object to call a well-known method on the object.
Not to toot my own horn, but check out my article on PB's web site:
http://www.powerbasic.com/support/te...threading3.asp
Note that there is a hard-coded path in one of the Declares when you download the code, but the rest should work just fine.
BTW, there is a way to call a class method on a callback. Buy Matt Curland's "Advanced Visual Basic 6" book to find out.
Regards,
Jason Bock
------------------
Leave a comment:
-
PB Callingback > VB
I remember many discussions about having a dll function callback within
VB, and I remember the outcome to always cause a GPF.
Has anyone worked a solution? This is what I'm trying to do.
Make .DLL in PowerBasic
Make .OCX that wrappes the .DLL in Visual Basic and the .DLL sends callbacks to the .OCX
I could simply make a type library and call that within my .OCX but that
somewhat seems less productive.
Any ideas?
Thanks,
Greg
------------------
-GregTags: None
Leave a comment: