i tryied to find the process handle,
HWND handle = FindWindow(0 ,TEXT("window title"));
i need window title
Let's say that I have tow process with the same title
so i want to make something like:
for each p as process in process.getProcessByName("notepad")
if process.processname = "notepad" then
handle = p.handle
exit for
end if
next
You have to enumerate the running processes yourself looking for the names manually. You can do that using either:
1)
CreateToolhelp32Snapshot()
,Process32First()
, andProcess32Next()
. See MSDN for an example:Taking a Snapshot and Viewing Processes
2)
EnumProcesses()
,OpenProcess()
,EnumProcessModules()
andGetModuleBaseName()
. See MSDN for an example:Enumerating All Processes
3) use WMI to enumerate the items in the
Win32_Process
collection.