Maptitude GISDK Help

Accessing COM Objects

 

Maptitude can access COM objects in several ways:

When Maptitude acts as an OLE/COM client, the COMObject variable type provides access to COM objects. You can create a new instance of the object, or you can get the currently active instance of the object:

 

GISDK Function Summary
CreateCOMObject() Creates a new instance of a COMObject
GetCOMObject() Gets the currently active instance of a COMObject

 

For example, you can create an instance of Microsoft Excel as follows:

 

excObj = CreateCOMObject("Excel.Application", )

 

To get and set properties of the COMObject, use dot notation:

 

Obj.Property

 

For example:

 

wind = excObj.ActiveWindow

wind.Width = 250

 

You can also use this form:

 

excObj.ActiveWindow.Width = 250

 

For indexed properties or collections, use this form:

 

Obj.Property[idx]

 

For example:

 

doc = excObj.Documents.Item[0]

 

You to use string indices inside square brackets on COM collections:

 

objConfig.Fields.Item["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2

 

Use dot notation to call methods on the COMObject:

 

Obj.Method(args)

 

For example:

 

wind.Close()

 

In the following example, the method returns a value of the appropriate type, or null if there is no return value:

 

pts = ExcObj.InchesToPoints(2.5)

 

Method arguments can be passed by reference where appropriate, using the & prefix, to get back the value of an out parameter, such as:

 

vms.GetFlow(5, &flow)

 

You can use these other COM-related GISDK functions:

 

GISDK Function Summary
CloseCOMControl() Closes the window containing the COM control
CreateCOMControl() Creates a new COM control window
GetCOMCollectionObjects() Gets the COM objects in a COM collection
GetCOMControlObject() Gets the COM interface of a COM control window
GetCOMInterfaceName() Gets the name of the COM interface for an object from the type library

 

For more information on COM control windows, see Windows.

 

You can also create COM controls in dialog boxes; for more information, see COM Control Items.

 

 

©2025 Caliper Corporation www.caliper.com