devxlogo

Passing Parameters by Reference

Passing Parameters by Reference

Question:
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 ?

Answer:
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.

See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist