how to get a thread's handle

  • Thread starter Thread starter huajiao
  • Start date Start date
H

huajiao

i want to use the API:
PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam)
to post message to a thread.
so i need the thread's handle.
thanks!
 
The syntax of this function is:
BOOL PostMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
where hWnd is a handle to a window.
If you want to post a message to a thread you should take a look at
BOOL PostThreadMessage(
DWORD idThread,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
 
Does that return the actual OS thread id? I was under the impression that
it was an internal logical thread id since the mapping of the managed thread
object to the OS "real" thread used can change.
 
Does that return the actual OS thread id?

Yes it does (currently). But it might not be guaranteed to do so in
future versions.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top