Instruction manual
AMPDIO DRIVERS
Page 81
4) Add the library newly generated file DIO_TC.LIB to project workspace. Note the DIO_TC.LIB
supplied with the AMPDIO package is a Microsoft format library file and is incompatible with
Borland compilers.
6.3.2 Visual Basic 5.0 and 6.0
The Visual Basic example projects can be opened from within Microsoft Visual Basic by choosing
‘File|Open Project…’ in the menu and selecting the appropriate .VBP project file within the EX_VB
subdirectory of the AMPDIO software directory. The project window will now appear on the
desktop. Double-clicking on a .VBP file from within Windows Explorer should also cause Microsoft
Visual Basic to run with the selected project file open. Double-click on any file in the project to view
the source code, or select Run to run the program.
Note that the .VBP files supplied with AMPDIO v5.00 and later were saved by Visual Basic 6.0.
They can still be used with Visual Basic 5.0, but a warning dialog will appear about a ‘Retained’
key. If you tell Visual Basic to continue loading the project, it will work correctly. Saving the project
in Visual Basic 5.0 will stop the warning occuring the next time the project is loaded.
To create your own Visual Basic program from scratch, perform the following steps:
1) From within Microsoft Visual Basic, select 'File|New Project'. A new project window will appear,
into an empty Form1 design window will appear.
2) Select 'File|Add file...' and select ‘DIO_TC.BAS’ from the EX_VB subdirectory of the AmpDIO
software directory.
3) Double-click on the empty Form1 design window to bring up the code window for the
Form_Load() subroutine. At runtime, this routine will be called when the program first starts up.
4) Type the following lines into the Form_Load() subroutine:
Do
hBoard = registerBoardEx(i)
If hBoard >= 0 Then
CardType = GetBoardModel(hBoard)
If CardType = <Wanted> Then
Exit Do ' Exit loop as we
' have a valid board
Else
' Free the unwanted board
FreeBoard(hBoard)
End If
End If
hBoard = -1 ' We don't have a suitable card
' Try the next board
i = i + 1
Loop Until (i >= 8)
5) These lines of code will search through installed ADIO cards until the desired card type is
found. The limit of 8 in the ‘Loop Until (i >= 8)’ condition may be increased to 256 if
using DIO_TC.DLL version 4.40 or later.
6) Put away the code window, and select the Form1 design window.
7) Select 'Window|Menu Design...' to bring up the dialog box from which you design the form's
menubar. Type 'Exit' as the caption and 'mnuExit' as the name for the first menu bar item, then
click on OK to put the dialog box away.