ExtendedHostFunctionsnewComObj Method | 
            Creates a COM/ActiveX object of the specified type.
            
Namespace: Microsoft.ClearScriptAssembly: ClearScript.Core (in ClearScript.Core.dll) Version: 7.5.0
Syntaxpublic Object newComObj(
	string progID,
	string serverName = null
)
Public Function newComObj ( 
	progID As String,
	Optional serverName As String = Nothing
) As Object
public:
Object^ newComObj(
	String^ progID, 
	String^ serverName = nullptr
)
member newComObj : 
        progID : string * 
        ?serverName : string 
(* Defaults:
        let _serverName = defaultArg serverName null
*)
-> Object Parameters
- progID  String
 - The programmatic identifier (ProgID) of the registered class to instantiate.
 - serverName  String  (Optional)
 - An optional name that specifies the server on which to create the object.
 
Return Value
ObjectA new COM/ActiveX object of the specified 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 creates a 
            
Scripting.FileSystemObject
            instance and uses it to list the drives on the local machine.
            It assumes that an instance of 
ExtendedHostFunctions is exposed under
            the name "host"
            (see 
AddHostObject).
            
var fso = host.newComObj('Scripting.FileSystemObject');
var ConsoleT = host.type('System.Console');
for (en = fso.Drives.GetEnumerator(); en.MoveNext();) {
    ConsoleT.WriteLine(en.Current.Path);
}
See Also