

AutoHotkeyは、小さな自動化TOOLをつくるのには非常に便利なスクリプト言語です。
アイディア次第で何でもできます。
ダウン先:
AutoHotkeyの本家フォーラムで、見つけたコードです
動かしたら、文字化け

一日悩みました。エンコードが問題だろうと推測しましたが解決策が見つかりません。
ようやく見つけました、上記サイトを読んで下のコードの「GetModuleFileNameExA」Aがいりません。
result := DllCall( "psapi.dll\GetModuleFileNameExA", "uint", h_process, "uint", 0, "Str" , name, "uint", name_size )
Windows APIには関数2つ含まれてる?ANSI版とUnicode版
よくわかりません。でも解決した。
私の使ってるAutoHotkey_LのUnicode版なので動きませんでした。
アクティブ・ウィンドウのソフト名+パスを取得する
^F2:: WinGet, PID, PID, A FullEXEPath := GetModuleFileNameEx( PID ) FileGetVersion, Version, %FullEXEPath% MsgBox, 0, %Version%, %FullEXEPath% Return GetModuleFileNameEx( p_pid ) ; by shimanov - www.autohotkey.com/forum/viewtopic.php?t=9000 { h_process := DllCall( "OpenProcess", "uint", 0x10|0x400, "int", false, "uint", p_pid ) if ( ErrorLevel or h_process = 0 ) return name_size = 255 VarSetCapacity( name, name_size ) result := DllCall( "psapi.dll\GetModuleFileNameEx", "uint", h_process, "uint", 0, "Str" , name, "uint", name_size ) DllCall( "CloseHandle", h_process ) return, name }

コメント