One common problem faced by many programmers while using DLL functions in Visual Basic is NOT specifying the ByVal for String Parameters.
Correct Declaration
Declare Function SQLRequest Lib "RTSLINK.DLL" (ByVal strSQL As String) As Long
Incorrect Declaration
Declare Function SQLRequest Lib "RTSLINK.DLL" (strSQL As String) As Long
Remarks:-
By default, parameters are passed by Reference in Visual Basic. If you need to pass the parameter ByVal, it has to be explicitly specified using the ByVal keyword.
Please note that the String parameters are to be always passed ByVal to DLL functions.
No comments:
Post a Comment