Quote Originally Posted by NirDemchog View Post
Does it mean that this code becomes part of the process where this threadId is part of? If i create another thread in the dll , will it be part of that process that i am hooked to ?
1) Yes, assuming that thread has a messagequeue associated with it.
2) the thread you create "becomes part" of whatever process you created it in. thread creation is Always associated with the process that creates the thread. so 'it depends' where you call CreateThread. if you call it from the messagehook then yes, it's in the other process, if you call it from the process that does the SetWindowsHookEx, then it'll be in your 'hook installer' process.

If you want to explicitely create a thread in another process, use CreateRemoteThread().