ComObjGet
Returns a reference to an object provided by a COM component.
OutputVar := ComObjGet(Name)
Function Example: wmi := ComObjGet("winmgmts:")
Parameters
- OutputVar
The name of the variable in which to store the Com object.
- Name
The display name of the object to be retrieved. See MkParseDisplayName (MSDN) for more information.
Related
ComObjCreate, ComObjActive, ComObjConnect, ComObjError, ComObjQuery, CoGetObject (MSDN)Examples
; Example: Press Shift+Escape to show the command line which was used ; to launch the active window's process. Requires XP or later. +Esc:: pid := WinGetPID("A") ; Get WMI service object. wmi := ComObjGet("winmgmts:") ; Run query to retrieve matching process(es). queryEnum := wmi.ExecQuery("" . "Select * from Win32_Process where ProcessId=" . pid) ._NewEnum() ; Get first matching process. if queryEnum[process] MsgBox(process.CommandLine, "Command line", 0) else MsgBox Process not found! ; Free all global objects (not necessary when using local vars). wmi := queryEnum := process := "" return ; Win32_Process: http://msdn.microsoft.com/en-us/library/aa394372.aspx