Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Passing Parameters by Reference

I have a function in a DLL that I want to call from VB program. The Dll function has few parameters. Some of them should be passed from vb and some should be return from the dll. For example, I declared the function like Function(A1 as double,A2 as double,B1as double,B2 as string) as integer. Now, the parameters A1, A2, and B1 will be passed to the Dll wheras B2 is a string that should be return by the Dll. You know, calling the function in a way like dummy=Function(A1,A2,B1,B2) will make VB think that I'm passing B2 to the Dll like the other parameters. How can I get B2 back from the Dll ?

Take a look at the example using the GetPrivateProfileString API function. This one returns values in the different parameters passed to it. I don't think VB worries about whether or not the parameters are getting filled or not.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date