PostMessage fails if you pass in NULL as the HWND argument.
According to the MSDN, a NULL HWND means "The function behaves
like a call to PostThreadMessage with the dwThreadId parameter
set to the identifier of the current thread." Currently,
PostMessage tries to get the thread id of the hwnd, which of
course fails since it's NULL in this case, and of course the
error is Invalid Window Handle.

It seems like a simple fix is a test if hwnd is NULL and calling
PostThreadMessage with the right thread ID, but I don't know how
to get the current thread's ID.  Any ideas/suggestions?

-Steve


Reply via email to