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

enter image description here

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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -