ExtendedHostFunctionscomType Method |
Imports a COM/ActiveX type.
Namespace:
Microsoft.ClearScript
Assembly:
ClearScript.Core (in ClearScript.Core.dll) Version: 7.3.1
Syntaxpublic Object comType(
string progID,
string serverName = null
)
Public Function comType (
progID As String,
Optional serverName As String = Nothing
) As Object
public:
Object^ comType(
String^ progID,
String^ serverName = nullptr
)
member comType :
progID : string *
?serverName : string
(* Defaults:
let _serverName = defaultArg serverName null
*)
-> Object
Parameters
- progID
- Type: SystemString
The programmatic identifier (ProgID) of the registered class to import. - serverName (Optional)
- Type: SystemString
An optional name that specifies the server from which to import the type.
Return Value
Type:
ObjectThe 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}").
Examples
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).
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