Visual Basic .NET Code Sample
Within Visual Studio .NET, select Project > Add Reference…. This brings up a dialog. Select the COM tab, then Browse, and change the path to the idlexfoo.dll. This imports the object reference into the project.
Within the project that will use the wrapper object, include the following line at the top of the form:
Imports IDLexFooLib
Initiation Without Parameters in Visual Basic .NET
Use the following code to initialize the object with no parameters.
Private Sub Button1_Click(...)
Dim oFoo As New IDLexFooClass()
Try
oFoo.CreateObject(0, 0, 0)
Catch ex As Exception
Debug.WriteLine(oFoo.GetLastError())
Return
End Try
' use object here...
End Sub
Initiation with Parameters in Visual Basic .NET
Use the following code to initialize the object with its three parameters (a string, a 32-bit long value, and an array that has two rows and three columns, containing 32- bit long values).
Inside the Public Class definition for the form and before any subroutines, you must add the following two lines:
Const PARMFLAG_CONST As Integer = &H1
Const PARMFLAG_CONV_MAJORITY As Integer = &H4000
Then create the object within your program:
Private Sub Button1_Click(...)
Dim oFoo As New IDLexFooClass
Dim parmStr As String = "I am a string parameter"
Dim parmVal As Int32 = 24
Dim parmArr As Int32(,) = {{10, 11, 12}, {20, 21, 22}}
Dim argc As Int32 = 3
Dim argval As Object() = {parmStr, parmVal, parmArr}
Dim argpal As Int32() = {PARMFLAG_CONST, PARMFLAG_CONST, (PARMFLAG_CONST + PARMFLAG_CONV_MAJORITY)}
Try
oFoo.CreateObject(argc, argval, argpal)
Catch ex As Exception
Debug.WriteLine(oFoo.GetLastError())
Return
End Try
' use object here...
End Sub