Saturday 15 September 2012

c++ - How Could I Get the Window Title from Its Process Name? -



c++ - How Could I Get the Window Title from Its Process Name? -

this code check if process name existed or not:

bool isrunning (lpcstr processname) { handle snapshot; snapshot = createtoolhelp32snapshot(th32cs_snapprocess, 0); if(snapshot != invalid_handle_value) { processentry32 processentry; bool succeed; processentry.dwsize = sizeof(processentry32); succeed = process32first(snapshot, &processentry); while(succeed) { if(lstrcmp(processentry.szexefile,processname) == 0) { homecoming true; } succeed = process32next(snapshot, &processentry); } closehandle(snapshot); } }

how utilize or edit window title process name (for illustration "notepad.exe")? if existed programme homecoming text "new text document - notepad"

this addressed in microsoft's description of createtoolhelp32snapshot.

it says "you can utilize queryfullprocessimagename function retrieve total name of executable image both 32- , 64-bit processes 32-bit process."

you'll need iterate through checking handles queryfullprocessimagename.

c++ process

No comments:

Post a Comment