Next: Tutorial, Previous: Tools [Contents][Index]

## 4 Sample GNATCOM Applications

GNATCOM comes with a number of sample applications that demonstrate how to use the GNATCOM framework and bindings created by the GNATCOM tools. Many of these applications require bindings be generated for COM components first. The batch file make.bat in the bindings directory will create the needed bindings.

The res directory contains any needed files to create the Win32 resource files for the samples.

- NT_GNATFIND

  Demonstrates creating a GUI front end to a command line application using the Internet Explorer Web Browser Control and handling COM events.

  There are a number of different versions of this sample application (nt_gnatfind.adb) located in different directories.

  1. Samples/ Sample application using VTBL bindings
  2. Samples/Dispatch/ Sample application using dispinterface (IDispatch) bindings
  3. Samples/Dynamic/ Sample application using the GNATCOM frameworks binding to dispinterface with out any generated bindings.
- Spin

  Demonstrates use of ActiveX GUI Controls using the Internet Explorer Web Browser Control as the ActiveX control container, COM events, and using COM from Ada tasks.

  There are a number of different versions of this sample application (spin.adb) located in different directories.

  1. Samples/ Sample application using VTBL bindings
  2. Samples/Dispatch/ Sample application using dispinterface (IDispatch) bindings
  3. Samples/Dynamic/ Sample application using the GNATCOM frameworks binding to dispinterface with out any generated bindings.
  4. Samples/GIT Sample application using an alternate method of using multiple tasks in with GNATCOM that demonstrates use of the Global Interface Table to pass interfaces across COM apartment boundaries.
- ADO

  Demonstrates use of GNATCOM with ADO (Microsoft ActiveX Data Objects) to access an ODBC database.

  The example (ado2.adb) is in the Samples/ directory. It requires that an ODBC DSN be created with the name ADOTEST pointing to the Access database in the Samples/res directory adotest.mdb.

  The example (ado1.adb) is in the Samples/ directory. It uses the Access OLEDB provider to connect to an Access database instead of ODBC and does not require any ODBC or other configuration.

  The example (ado3.adb) is in the Samples/ directory. It uses a UDL file found in the Samples/res directory to configure the connection via OLEDB to the access datatbase. UDL files are created by creating a blank file with the extension .udl. Once the file is created double clicking on it brings up the configuration application. It may be necessary to modify the configuration in the udl file in order for the example to work.

- JavaCall

  Demonstrates calling Java code by using the COM Java moniker.

  The example (javacall.adb) is located in the Samples/ directory.

- MSMQ

  Demonstrates use of GNATCOM with Microsoft Message Queueing (MSMQ) one of the COM+ services available on Windows 2000 and with the Microsoft Option Pack 4.

  The server (msmq_server.adb) and client (msmq_client.adb) applications are in the Samples/ directory.

- VB Examples

  Demonstrates methods of interfacing Ada code to Visual Basic.

  Two projects AdaToVB and VBtoAda are located under the Samples/VB/ directory.

Next: Tutorial, Previous: Tools [Contents][Index]