Copyright: Copyright Aldea Interactive 1996-1997. All rights reserved.


AG Samples : Introduction
Introduction

The purpose of these examples is to show how to rapidly develop efficient Active Gateway Clients. For a better understanding we tried to simplify those examples. Remember that they are only examples and have no other use than to demonstrate how to use Active Gateway components.

Active Gateway is provided with a set of constant files to help you with your development of this application.:

•	AldeaCst.bas for Visual Basic

•	AldeaCst.pas for Delphi

•	AldeaCst.lss for Lotus Notes

C++ developer will use AGCore headers located in the "Win32Headers" directory.

Examples Using the AGCtrl ActiveX Control:

•	Web page (HTML and VBScript):

•	AGClient

•	Microsoft Visual Basic 4.0:

•	AGClient

•	AGChat

•	AGMail

•	Microsoft Visual C++ 4.2:

•	AGClient

•	AGClientSQL

•	AGClientTxt

•	Borland Delphi 2.0:

•	AGClient


AGClientSQL under Visual C++
AGClient under VBScript (Web)

This example was made in HTML and VBScript for Internet Explorer 3.0x using the Active Gateway ActiveX control.

The purpose of this example is to show the integration of the Active Gateway ActiveX Control (AGCtrl) into a Web page and to test all the control methods.

Each button of the interface explains the use of a method of the ActiveX Control. The result of each run is displayed into the text window.

See also

AGClient under Visual Basic


AGClient under Visual Basic

This example was made under Microsoft Visual Basic 4.0 using the Active Gateway ActiveX control.

The purpose of the example is to show the integration of the Active Gateway ActiveX control into a VB application and to test all the control methods.

Each interface button corresponds to a control method. The result of each run is displayed in the text window.

To build the frame, use the Path field to indicate the slot path (for example: address.city) and the Value field to the slot value. Select the slot type by using the Type radio group button. The Value field is used by SetLength (array length), PutFileIntoSlot and GetFileFromSlot (file specification). The Path field is used by the Send and SendTo methods to specify the to send and by the Get and GetFrom methods to specify the slot where the received frame will be put.


AGChat under Visual Basic

This example was made under Microsoft Visual Basic 4.0 using the Active Gateway ActiveX control.

The purpose of this example is to show the integration of the Active Gateway ActiveX Control (AGCtrl) into a VB application and to show an example of synchronous connection mode use  without confirmation connection mode use.

First, enter the server name to connect, your name (client name) and the peer name. When connected, you can communicate with your peer by entering the text into the first zone. The text is sent at the time you enter return. The text sent by the peer is displayed into the second zone. To update evenly this zone, a timer is used which verifies if the data are available.


AGMail under Visual Basic

This example was made under Microsoft Visual Basic 4.0 using the Active Gateway ActiveX control.

The purpose of this example is to show the integration of the Active Gateway ActiveX Control (AGCtrl) into a VB application and to show an example of "Store and Forward" asynchronous connection mode use.

First, enter the server name to which you want to connect and your name (client name). When connecting, you can send and receive messages. The Peer(s) name fields allow you to indicate the peer(s). The asynchronous mode allows you to indicate several peer(s) (separated by a semi colon (;)) and to use the asterisk wildcard (*). For example: clienta;peer*.


AGClient under Visual C++

This example was made under Microsoft Visual C++ 4.2b using the Active Gateway ActiveX control.

The purpose of this example is to show the integration of the Active Gateway ActiveX Control (AGCtrl) into a C++ application and to test all the control methods.

Each button of the interface explains the use of a particular method of the ActiveX Control. The result of each run is displayed into the text window.

See also

AGClient under Visual Basic


AGClientSQL under Visual C++

AGClientTxt is an example for Win32 applications which shows how to use the AGSQL extension. This example was made under Microsoft Visual C++ 4.2b and use the Active Gateway ActiveX Control (AGCtrl).

In order to use this example you must:

•	Install and register the AGSQL extension.

•	Set up an ODBC source (for example: name="AG_SqlSrv",login="MyName",password="MyPassword") on the machine which hosts the Active Gateway Server and the AGSQL extension. The data source can be any relational database like Access, SQL Server or Oracle. Warning: in order to use the example, the account that accesses the data source must be able to create and delete a table, insert, update or delete records. If you use a RDBMS like SQL Server or Oracle Server, ask your database administrator for a special account and a special database which must contain no real data.

When you run the example, fill the server address (127.0.0.1 if the server and the client are on the same host) and ODBC source information (with the information you entered when you’ve set up the data source). To perform the example, just click on the "Step 1" to "Step 11" buttons and watch the result in the text field on the right.

The SQL Exec button lets you perform a SQL query directly, but you will not be able to see the result with the current version of AGSQL. You just know whether the query succeeded or failed.


AGClientText under Visual C++
AGClientTxt under Visual C++

AGClientTxt is a example for Win32 applications which shows you how to use the AGText extension. This example was  made under Microsoft Visual C++ 4.2b and use the Active Gateway ActiveX Control (AGCtrl).

AGClientTxt sends a frame to the AGText extension which will export the frame data as a file. To change the data sent by this example, you need to modify the source code. The application dialog allows you to change values passed in the OPTIONS frame and to change the Active Gateway Server address (which by default is 127.0.0.1, the local TCP/IP host).

You need to connect to the Active Gateway Server before you can launch a request to the extension. To do it, activate the Open button. The button used to send the request is Launch. To close the connection with the server, use the Close button.


AGClient under Delphi

This example was made under Borland Delphi 2.0 using the Active Gateway ActiveX control.

The purpose of this example is to show the Active Gateway  ActiveX Control (AGCtrl) integration into a Delphi application, to perform an asynchronous connection between two clients, and to exchange data from the first client to the second client.

The application window is divided into two parts: one for the first client which contains a first control and the other for the second client which contains a second control and which will receive the data sent by the first client.

The data sent are identification and address of a person. You have the possibility to change these values. The Clear button allows to clear the fields and the Default button allows you to put the value as the default.

When you click the 1 --> 2 button, the transfer of the data is activated following these steps:

•	You will start by opening the asynchronous connection to the server for the two clients.

•	The Client1 builds a frame he will send to the server:

frame example:

{
FirstName : "John"
LastName : "Doe"
Age : 50
Address
{
Street : "First street"
StreetNb : "6"
City : "Rome"
}
}

•	The client 1 sends the frame to the server for the client2 using a Send. Being in asynchronous mode, the frame is stored on the server.

•	The client2 receives the frame stored on the server performing a Get, and updates the corresponding fields.