c - ProcessID confusion -
i'm confused.
why notepad.exe have 3 different process id's?
1)spy++ says 000000a48 (eh?)
2)taskmanager says: 2632
3)getwindowthreadprocessid says: 1744
i guess 2632 right 1 use in setwindowshookex (as dwthreadid parameter), if getwindowthreadprocessid returns else, how find right one?
there 1 single unique process id process. spy++ reporting value hexadecimal, , task manager reports decimal. now, a48 (hexadecimal) equal 2632 (decimal).
the other value, 1744, thread id. id of different object. threads , processes not same things. process contains 1 or more threads.
when call getwindowthreadprocessid
returns window's thread id return value of function. second parameter can used return process id of process owns thread. call this:
dword pid; dword tid = getwindowthreadprocessid(wnd, &pid);
after function returns, pid
contains process id.
you trying install hook , need thread id that. in code use variable npthreadid
.
Comments
Post a Comment