sbennetts
asked on
VB and pointers et al
This is something that's probably been covered time and time again. I'm working with external DLLs that require pointers to byte array and also pointers to the equivalent of a DWORD.
I think I understand the pointer to a byte array, using the concept of ByRef and myArray(0) to pass to a DLL or return from a DLL, but what about a DWORD, how can I pass a pointer to my variable in VB and either pass my number to the DLL or get it to pass a response back into my variable?
If that makes any sense, I'll be very surprised.
Thanks
Simon
I think I understand the pointer to a byte array, using the concept of ByRef and myArray(0) to pass to a DLL or return from a DLL, but what about a DWORD, how can I pass a pointer to my variable in VB and either pass my number to the DLL or get it to pass a response back into my variable?
If that makes any sense, I'll be very surprised.
Thanks
Simon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I usually find some API with parameters of required type and see how API viewer generated API declaration. For example, to see difference between DWORD and DWORD* you can compare GetComputerName and GetWindowText.
ASKER
...but how does that tell you about the actual function call in the DLLs?
ASKER
i.e. what they are expecting in...
Compare GetComputerName and GetWindowText API declarations in MSDN and generate their VB declarations using API Viewer. When Dll function has DWORD* parameter, you pass ByRef Integer. Dll gets DWORD* and may change this variable.
ASKER
Many thanks
Simon
Simon
ASKER