Click to See Complete Forum and Search --> : Get the handle


paulinnn
February 17th, 2005, 07:23 PM
Hey guys,
is there any way to get the handle of an .exe?
i donyt have the title of the window.. i just have the name o the .exe...

does anyone can help me ?

ynks

mamut
February 17th, 2005, 07:49 PM
Which handle do you want to get?
An .exe file on the disk doesn't have a handle.
Open it using CreateFile(), -> a file handle.
Execute it using CreateProcess(), -> a process handle
A running program can get handle of itself using GetModuleHandle()

wake
February 17th, 2005, 09:15 PM
You can enumerate processes like Windows Task Manager using the toolhelp32 library. Theres a good example of usage located on here (http://www.codeproject.com/threads/processes.asp) on Codeproject.

Andreas Masur
February 18th, 2005, 02:52 AM
Enumerating All Processes (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/base/enumerating_all_processes.asp)