Click or drag to resize

ExtendedHostFunctionscomType Method

Imports a COM/ActiveX type.

Namespace: Microsoft.ClearScript
Assembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
Syntax
public Object comType(
	string progID,
	string serverName = null
)

Parameters

progID  String
The programmatic identifier (ProgID) of the registered class to import.
serverName  String  (Optional)
An optional name that specifies the server from which to import the type.

Return Value

Object
The imported COM/ActiveX type.
Remarks
The progID argument can be a class identifier (CLSID) in standard GUID format with braces (e.g., "{0D43FE01-F093-11CF-8940-00A0C9054228}").
Example
The following code imports the Scripting.Dictionary class and uses it to create and populate an instance. It assumes that an instance of ExtendedHostFunctions is exposed under the name "host" (see AddHostObject).
JavaScript
var DictT = host.comType('Scripting.Dictionary');
var dict = host.newObj(DictT);
dict.Add('foo', 123);
dict.Add('bar', 456.789);
dict.Add('baz', 'abc');
See Also