返回对 COM 组件提供的对象的引用.
失败时抛出异常.
按下 Shift+Esc 来显示活动窗口进程的命令行.
+Esc::
{
pid := WinGetPID("A")
; 获取 WMI 服务对象.
wmi := ComObjGet("winmgmts:")
; 执行查询以获取匹配进程.
queryEnum := wmi.ExecQuery(""
. "Select * from Win32_Process where ProcessId=" . pid)
._NewEnum()
; 获取首个匹配进程.
if queryEnum(&proc)
MsgBox(proc.CommandLine, "Command line", 0)
else
MsgBox("Process not found!")
; 释放所有全局对象(使用局部变量时不需要这么做).
wmi := queryEnum := proc := ""
}
; Win32_Process: http://msdn.microsoft.com/en-us/library/aa394372.aspx