-
Hello Everyone-
I am having a problem with C++ DLL that I am calling from my VB program.
When I call the DLL I have to pass in a string and an integer. When I debug the program in C++ the string that is passed in is fine, but the integer that I am passing in gets screwed up. I am passing in "1" as the integer when I call the DLL in VB. When I am debugging in C++ the variable that the integer gets assigned to equals "1240848"
Is there some kind of conversion that must be done between C++ and VB so that integers can be passed back and forth?
I would greatly appreciate any help with this, if more info is needed please let me know.
-
If the C++ argument is int, it must be Long for VB.
This is because in C (and therefore C++), an int is the size of the system word, which on 32-bit systems is 4 bytes, equivalent to long. In VB the Integer type is still only 2 bytes, so you must use Long.
-
Thanks guys, I'll do that and see if it solves my problem.