ASP call VB (ActiveX DLL), parameter pass (pass reference) need to pay attention to

Source: Internet
Author: User

This morning to test the VB and C (DLL) between the interaction, passing parameters, did not encounter anything too big problem.

In the afternoon when the VB (ActiveX DLL) is called in ASP, the problem is encountered when passing parameters to VB (DLL) in ASP code.

Write VB and C (DLL) in the morning, when the VB parameter to C (DLL), the default is to pass the reference, unless shown in VB using ByVal.

In the afternoon to write ASP and VB (DLL), when the ASP parameters to VB (DLL), the default value, and I need to pass through the reference.

In VB (DLL), I display the type of the request parameter: ByRef x as Integer, called in ASP, throws an error: The parameter type of the call is incorrect

Obviously the application variable is an integer, passing the past is also really an integer type, why would such a mistake?

Search for long time, finally found a solution:

How does the ASP pass reference parameters into the DLL? http://bbs.csdn.net/topics/60474811

The key point: in VB (DLL) variables must not only be declared as BYREF but also as a Variant

Public Function Exportxls (ByRef x as variant, ByRef y As Variant) as Integer

End Function

In this way, when passing parameters in ASP, it is passed by reference, and the passed parameters can be modified inside VB (DLL).

However, the test also found that if the passing of a string, but also want to modify the string in VB (DLL), it is best to request a temporary string, and then handle the temporary string, and finally the string to the ASP passed the string variable. Otherwise, there will be unexpected results.

2014-04-01

ASP call VB (ActiveX DLL), parameter pass (pass reference) need to pay attention to

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.