ExtendedHostFunctionscomType Method |
Imports a COM/ActiveX type.
Namespace: Microsoft.ClearScriptAssembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.4.5
Syntax public 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 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
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}").
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).
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