PostThreadMessage sets GetLastError to 1444
In PostThreadMessage
my thread ID is correct, but I am 开发者_StackOverflow社区getting the error 1444 ("Invalid thread identifier. ").
Anyone know how to fix it?
The OS is the authority on whether thread IDs are valid, so if it's telling you your ID is invalid, then your ID is probably invalid. You have to trust the error codes until you can prove they're wrong, or else there's no use checking them at all. Before blaming the OS, make sure you've ruled out all other possibilities. Here are some examples:
- Maybe you used the thread handle instead.
- Maybe the thread has finished running already.
- Maybe the thread wasn't created successfully in the first place. Make sure you check the return value from CreateThread.
- Maybe the thread belongs to a process running on a different desktop.
- Maybe the thread doesn't have a message queue. A thread can create a message queue for itself by calling GetMessage or PeekMessage, for example.
精彩评论