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