返回由 COM 组件提供的对象引用.
ComObject := ComObjGet(Name)
需要获取的对象的显示名称. 请参阅 MkParseDisplayName (Microsoft Docs) 了解更多信息.
失败时, 函数可能会抛出异常, 退出脚本或返回空字符串, 具体取决于当前的 ComObjError() 设置和其他因素.
按下 Shift+Esc 来显示活动窗口进程的命令行. 需要 XP 或更高版本. 有关 Win32_Process, 请参阅 Microsoft Docs.
+Esc::
WinGet pid, PID, A
; 获取 WMI 服务对象.
wmi := ComObjGet("winmgmts:")
; 执行查询以获取匹配进程.
queryEnum := wmi.ExecQuery(""
. "Select * from Win32_Process where ProcessId=" . pid)
._NewEnum()
; 获取首个匹配进程.
if queryEnum[proc]
MsgBox 0, Command line, % proc.CommandLine
else
MsgBox Process not found!
; 释放所有全局对象(使用局部变量时不需要这么做).
wmi := queryEnum := proc := ""
return