Click to See Complete Forum and Search --> : Problem passing pointer to dll


Dmanley
September 24th, 2001, 04:08 PM
I have a VB program that calls a C++ dll and passes it a pointer to a byte.

I been able to make everything else work, the handles, strings, all of those, but when trying to pass a pointer I get a vb6.exe error saying the memory could not be read. I don't think it has anything to do with the C dll because I commented out all of the code inside the function to see if it was in there and still got the same problem.

I have a byte variable, I'm sending it byref and the c dll is supposed to write to that address.

Any ideas?

thank in advance

cksiow
September 24th, 2001, 07:16 PM
try declare the parameter as any


HTH

cksiow
http://vblib.virtualave.net - share our codes

Clearcode
September 25th, 2001, 02:45 AM
You could try declaring it
byval lpByte as Long

and in the call, passing VarPtr(btMyVariable)

?

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.

DSJ
September 26th, 2001, 09:28 AM
Declare YourCFunction(byval bParm as byte) as whatever

private Sub CallFunction()
dim bVar(100) as byte
dim ret as whatever
ret = YourCFunction(bvar(0))
end sub