Vaderman
October 4th, 2005, 10:40 AM
I've performed the following steps to create a thread:
HANDLE wait_a_bit = ::CreateEvent(NULL, TRUE, FALSE, RUNNING_EVENT);
::WaitForSingleObject(wait_a_bit, 10); // synchronise threads
// doing some code here... The Thread is created in DLL, then returns the Thread_ID of the newly created thread.
...
bRetVal = ::CloseHandle(wait_a_bit);
...
//Some more code to handle messages sent from RUNNING_EVENT DLL
all this works fine and dandy enough... but when I try and use ::PostThreadMessage(..), the last error code is ERROR_INVALID_THREAD_ID.
Now when I step through my code and using Spy++, I see at the point where the new thread is created from within the DLL, the Thread ID becomes available and is valid, but ::PostThreadMessage is telling me that it isn't!! :mad:
Has anyone any ideas as to what I may be doing wrong?
Regards
John
HANDLE wait_a_bit = ::CreateEvent(NULL, TRUE, FALSE, RUNNING_EVENT);
::WaitForSingleObject(wait_a_bit, 10); // synchronise threads
// doing some code here... The Thread is created in DLL, then returns the Thread_ID of the newly created thread.
...
bRetVal = ::CloseHandle(wait_a_bit);
...
//Some more code to handle messages sent from RUNNING_EVENT DLL
all this works fine and dandy enough... but when I try and use ::PostThreadMessage(..), the last error code is ERROR_INVALID_THREAD_ID.
Now when I step through my code and using Spy++, I see at the point where the new thread is created from within the DLL, the Thread ID becomes available and is valid, but ::PostThreadMessage is telling me that it isn't!! :mad:
Has anyone any ideas as to what I may be doing wrong?
Regards
John