CreateCOMControl()
Summary
Creates a new COM control window.
Changes
Added to Version 5.0.
Syntax
string = CreateCOMControl(string name,string progid, array options)
| Argument | Contents |
|---|---|
| name | The desired name for the COM control window |
| progid | The program ID of the COM control |
| Option | Type | Contents |
|---|---|---|
| Activate Macro | String | The name of a macro that is called whenever the map is activated |
| Close Macro | String | The name of a macro called when the user closes the map from the system menu |
| Context Menu | String | The name of the menu resource to use to display a custom context menu when there is a right click on the window |
| Done Macro | String | The name of a macro that is called after the window is closed |
| Event Macro | String | The name of a macro called whenever the control fires an event |
| Resize Macro | String | The name of a macro called whenever the window is resized by the user |
| Aspect Ratio | 2 integers | The aspect ratio of the window (height, width) |
| Menu | String | The menu associated with the map window |
| Position | Array | The screen location of the window in an array of 2 integers {x, y} |
| Size | 2 integers | The screen size of the window (x, y) |
| Toolbar | String | The toolbar associated with the map window |
Returns
The name of the COM control window.
Notes
-
The event macro is called with 3 arguments: the COM interface to the control, the event name as a string, and an array containing the parameters passed by the event.
-
The resize macro is called with 3 arguments: the COM interface to the control, and the new width and height of the COM control window in pixels.
-
Window size and position are specified as percentages of the frame window.
-
If the menu, toolbar, activate macro, or close macro is not specified, CreateCOMControl() uses the default specified with SetDefaults(). If a layout-specific default was not specified with SetDefaults(), then CreateCOMControl() uses the generic default.
-
Some controls handle the right-click themselves and this will preempt the Context Menu option.
Example
name = CreateCOMControl("My Control", "Shell.Explorer", {{"Event Macro", "Explorer Event Macro"}})
Error Codes
| Error | Meaning |
|---|---|
| Error | One of the options is invalid |
See Also
| Function | Summary |
|---|---|
| CloseCOMControl() | Closes the window containing the COM control |
| CreateCOMObject() | Creates a new instance of a COMObject |
| GetCOMCollectionObjects() | Gets the COM objects in a COM collection |
| GetCOMInterfaceName() | Gets the name of the COM interface for an object from the type library |
| GetCOMControlObject() | Gets the COM interface of a COM control window |
| GetCOMObject() | Gets the currently active instance of a COMObject |
| SetCOMControlTitle() | Sets the title of a COM control window. |