Instruction manual
AMPDIO DRIVERS
Page 84
Application’ in the ‘Templates’ box. Enter a name for the project and specify a location using
the ‘Browse…’ button. Press the ‘OK’ button to continue.
2) Select ‘File|Add Existing Item’ from the menu and add DIO_TC.VB from the the EX_VBNET
subdirectory of the AmpDIO software directory.
3) Close the Form1 design window and source code window (if present) and open the properties
for the project, ‘Project|<Project name> Properties’. Clear the ‘Root Namespace’ property to
allow the DIO_TC.VB file to be used without modification. Press ‘OK’ to close the project
properties dialog.
4) Select ‘View|Solution Explorer’ from the menu. Double click on the Form1.vb file in the Solution
Explorer window to open the form design window. Double-click on the empty Form1 design
window to bring up the code window for the Form1_Load() subroutine. At runtime, this routine
will be called when the program first starts up.
5) At the top of the source code window, enter the following line to import the DIO_TC.DLL
functions:
Imports Amplicon.AmpDIO.DIO_TC
6) Add the following code under ‘Public Class Form1’ after the ‘Inherits’ statements:
Dim hBoard As Short
7) Add the following code to the Form1_Load() subroutine:
Dim i As Short
Dim CardType As Short
Do
hBoard = registerBoardEx(i)
If hBoard >= 0 Then
CardType = GetBoardModel(hBoard)
If CardType = <Wanted> Then
Exit Do ' Exit main Loop as we
' have valid card
Else
' Free the unwanted card
FreeBoard (hBoard)
End If
End If
hBoard = -1 ' We don't have a suitable card
' Try the Next card
i = i + 1
Loop Until (i >= NUMBER_CARD_SUPPORTED)
8) While the cursor is in the Form1_Load subroutine, select the ‘Closed’ method from the drop-
down selection box at the top right of the source code window and add the following code to
the Form1_Closed subroutine:
If hBoard >= 0 Then
FreeBoard(hBoard)
End If
These steps will create the shell of a VB.NET application that can now be run. The program at this
stage does nothing more than register a board with the DLL on start-up, and free that board on
exit.
Section 6.4 describes the library functions available. Where arguments to functions are described
as pointers, the address of a user-declared variable is required. Visual Basic normally does this
anyway. The function declarations in DIO_TC.VB uses the ‘ByVal’ prefix for all function arguments