[RESOLVED] DLL + ByRef parameters
Hi everyone,
I would like to know if it is possible to create routines with ByRef parameters in a class module offered by a DLL.
I have made a test by creating a routine with a ByRef boolean parameter in a class module from a VB6 DLL ActiveX project. Then, I called the routine passing a local boolean variable from a VB6 client project. But, the boolean variable is unchanged after the routine execution.
Thanks for your future help.
Re: DLL + ByRef parameters
Not sure how you did it so here is a quick example of how it's done:
Code:
'dll project
Option Explicit
Public Sub Test(ByRef a As String, ByRef b As Boolean)
a = a & "b"
b = Not b
End Sub
'standard project
Private Sub Command1_Click()
Dim oClass As myDll.Class1
Dim a As String
Dim b As Boolean
a = "a"
b = True
Set oClass = New myDll.Class1
oClass.Test a, b
Debug.Print a; "; "; b '<<< output is "ab; False"
End Sub
As you can see both parameters were changed.
Re: DLL + ByRef parameters
I performed a new test and the ByRef mechanism works. I really don't know why my first test failed. Thanks for your help anyway.