Instruction manual
AMPDIO DRIVERS
Page 83
if hboard >= 0 then
begin
cardtype := GetBoardModel(hBoard);
if cardType = <Wanted> then exit;
FreeBoard(hBoard);
end;
hBoard := -1;
inc(i);
until (i >= 8);
end;
These lines of code will search through installed ADIO cards until the desired card type is
found. The limit of 8 in the ‘until (i >= 8)’ condition may be increased to 256 if using
DIO_TC.DLL version 4.40 or later.
5) Add the following global variable underneath the form class definition and global var statement:
var
Form1: TForm1;
hBoard:smallInt;
6) Type the following lines into the Form1Close() subroutine, to un-register the board from the
DLL as the program closes.
if hboard >= 0 then
FreeBoard(hboard);
These steps will create the shell of a Delphi 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. This is taken care of automatically
by Delphi because DIO_TC.PAS interface file insures that the variables will be passed correctly.
For example, function TCgetCount requires a pointer to a variable declared as long, into which the
count value result will be placed. A typical VB code example for displaying the Z1 Counter 0 count
value would be as follows:
var
count:LongInt;
begin
TCgetCount( h, Z1, 0, count );
// count now contains new value
Label1.caption := InttoStr( count );
6.3.4 Visual Basic .NET
The Visual Basic .NET example projects can be opened from within the Microsoft Visual Studio
.NET development environment by choosing ‘File|Open|Project…’ in the menu and selecting the
appropriate .VBPROJ project file within the EX_VBNET subdirectory of the AmpDIO software
directory. The project window will now appear on the desktop. Double-clicking on a .VBPROJ file
from within Windows Explorer should also cause Microsoft Visual Studio .NET to run with the
selected project file open. Double-click on any file in the project to view the source code or form
design (if both are present, they are displayed under separate tabs). To run the example, press the
F5 key or select ‘Debug|Start’ in the menu.
To create your own Visual Basic .NET program from scratch within Microsoft Visual Studio .NET,
perform the following steps:
1) From within Microsoft Visual Studio .NET, select ‘File|New|Project…’ in the menu. In the ‘New
Project’ dialog, choose ‘Visual Basic Projects’ in the ‘Project Types’ box and ‘Windows