passing structure from VC DLL to VB through CALLBACK function
Hi! I need some help...
I've successful wrote my DLL in VC with CALLBACK function support. But now I need to return a group of data in a form of structure from VC to VB.
Does anyone know how to work out this? For your info, I manage to return a string, long & others data type but not the structure.
regards,
Passing BSTR back to vb callback
Hi CorrnedBee
I am passing the string back to the vb callback Byval.
Something like this
Public function MyCallBack(Byval lNo as long,Byval lBuffer as long)
On the CPP side I pass the a long and bSTR (i've tried *BSTR) as well to the call back.
The lNo comes through fine.
The lBuffer contains a value. If I take the hex value of lBuffer it is the same memory address as the BSTR that I pass. I can even look at the memory in CPP and the string is there.
My Problem is I cant do anything with it Ive tried CopyMemory strlen - it all fails.
So What I tried is before i call the vb callback function i copy the data to a global cpp variable.
From the vb program I call a function that takes this global variable and pass it as a BSTR to vb. (This is the same function as Chris's OleString. It Works perfectly as long as I make this call outside my callback function.
If I put it inside I get the access violation.
Any Ideas:confused: