User manual

Programming examples
64 © 2007-2010 Analytica GmbH
7.2. Programming language Visual Basic 6
As already described in the previous chapters, the libraries of the AnaGate-API use the cdecl calling
convention to parse function parameters to the program stack. Unfortunately this is generally not supported
by the programming language Visual Basic 6.
To work around this limitiation, the libraries for the AnaGate devices are available in a specfic version for
programming VB6 applications. In this versions the stdcall calling convention is used, which is the only
supported by VB6. Except for the way the parameters are pushed on the stack these specific VB6 versions
of the API libraries are exactly identical to the standard versions.
Note
Use library AnaGateCAN.dll instead of library AnaGateCANVB6.dll.
Use library AnaGateSPI.dll instead of library AnaGateSPIVB6.dll.
7.2.1. SPI Example with user interface for VB6
This programming example for Visual Basisc 6 demonstrates how to connect to an AnaGate SPI and how
to execute a command on the SPI bus:
Getting the global device settings like baud rate for example
Sending a single command to the SPI bus
Note
The source code of the example can be found in directory Samples/SPI-VB6 on the CD.
7.2.1.1. User interface
Figure 7.1. Input form of SPI example (VB6)