ComObjGet()

提供: AutoHotkey Wiki
移動: 案内検索

実行制御 | GUI表示 | 演算・変数 | メモリ・DLL操作 | 文字列操作 | キーボード | マウス | シェル | ウィンドウ | ウィンドウグループ
ステータスバー | コントロール | サウンド | ファイル | INIファイル | レジストリ | 環境変数 | AutoHotkey | その他 | 設定関係 | オブジェクト

ComObjGet() [AHK_L 53+][編集]

AHKL COMコンポーネントによって提供されるオブジェクトへの参照を取得する。

ComObject := ComObjGet(Name)

Parameters[編集]

引数名 説明
Name 取得するオブジェクトの表示名を指定する。 MkParseDisplayName (MSDN)も参照のこと。

Related[編集]

ComObjCreate(), ComObjActive(), ComObjConnect(), ComObjError(), CoGetObject (MSDN)

Example(s)[編集]

; Example: Press Shift+Escape to show the command line which was used
;   to launch the active window's process.  Requires XP or later.
+Esc::
    WinGet pid, PID, 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 0, Command line, % process.CommandLine
    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