Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Byref or ByVal???
Message
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00414590
Message ID:
00417224
Views:
19
>>>>>>>>>>>>>>>>>>>>>>>>>
Hi,
I have a DLL function as the following, when I pass the parameter byRef, it does work fine instead I need to pass it byVal, why?

int _stdcall mfunction(int a,char * b);
>>>>>>>>>>>>>>>>>>>>>>>>>

As my fourth grade teacher used to say, "That's just the way it is!!!"

Only kidding... kinda. API calls written in, say, C, actually expect a different sort of "string" data than the VB "string" (and so on for many other data types). If you send the value, it works fine, because it converts the value. If you send the pointer of the actual variable, it will look at the variable, and say "what the heck is this?" At which point, quite likely, you get a GPF or a page fault.....

So, the workaround is.... use ByVal. It's the VB method for passign values to an external DLL API.
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Previous
Reply
Map
View

Click here to load this message in the networking platform