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.
 
Back
Top