/SRC/Ahk/sub/get_processname.ahk

http://candy-software.googlecode.com/ · AutoHotKey · 13 lines · 11 code · 1 blank · 1 comment · 1 complexity · 201f013d45a8ecce25156b9fd55aa96e MD5 · raw file

  1. ;By shimanov at http://www.autohotkey.com/forum/viewtopic.php?t=4182&postdays=0&postorder=asc&highlight=full+path&start=15
  2. GetModuleFileNameEx(p_pid )
  3. {
  4. h_process := DllCall( "OpenProcess", "uint", 0x10|0x400, "int", false, "uint", p_pid )
  5. if ( ErrorLevel or h_process = 0 )
  6. return
  7. name_size = 255
  8. VarSetCapacity( name, name_size )
  9. result := DllCall( "psapi.dll\GetModuleFileNameExA", "uint", h_process, "uint", 0, "str", name, "uint", name_size )
  10. DllCall( "CloseHandle", h_process )
  11. return, name
  12. }