Home > Overview > How to Work with the COM Interface > Creating Client Applications
The COM interface is a standard method of communicating between applications. You can develop a client application by using scripting languages (e.g., JavaScript) in an HTML page or by using non-scripting languages (e.g., C++ or C#) in a stand-alone or DLL application. For creating a client application using embedded controls see How to work with ActiveX Controls.
Working with Scripting Languages
In order to use the interfaces from a web browser, the browser must support ActiveX. Use the <OBJECT> tag to incorporate TerraExplorer in the page and then use the object properties to get access to all main interfaces.
Javascript is an example of a scripting language that you can use to add the TerraExplorer COM capabilities to any HTML page. You can display this HTML page in one of the TerraExplorer’s containers or in a separate web browser.
Follow these steps to create a Javascript client application using TerraExplorer interfaces:
1. Define the TerraExplorer Object – Use the HTML Object tag to declare the object using TerraExplorer’s unique class id.
<object id="SGWorld" classid="CLSID:3a4f91b0-65a8-11d5-85c1-0001023952c1" style="visibility:hidden;height:0 "></object>
2. Access the main interfaces – The HTML Object exposes an ISGWorld6 interface. Using this interface you can access all the main TerraExplorer interfaces. For example to zoom in you will need to call the INavigate6 ZoomIn method:
SGWorld.Navigate.ZoomIn();
Working with C#
Using C# or any non-scripting language allows you to develop more complex and powerful client applications.
The instructions provided here refer to Microsoft Visual Studio 2005.
Follow these steps to create a C# client application using TerraExplorer Interfaces:
1. Set Project References – From the Project menu, select Add References. Select the COM tab and locate TerraExplorerX 1.0 Type Library from the available references.
Note: When a reference to a COM component is added to a .NET project an interop dll is automatically created. You can find “Interop.TerraExplorerX.dll” in the obj folder of your project. This dll intermediates between the COM and .NET components.
2. Add Using directive – To access types in the TerraExplorerX namespace.
using TerraExplorerX;
3. Define Variable for SGWorld Object – Declare an SGWorld variable.
private SGWorld sgworld;
4. Create TerraExplorer Object – Use new to reference the variable to the SGWorld object.
this. sgworld = new SGWorld();
5. Access the main interfaces – Using this object you can access all the main TerraExplorer interfaces. For example to zoom in you will need to call the INavigate6 ZoomIn method:
SGWorld.Navigate.ZoomIn();