PostMessage and NULL HWND's

steve.lustbader at philips.com steve.lustbader at philips.com
Thu Nov 21 14:59:03 CST 2002


After about 5 seconds of thinking, I solved the problem -
you've got to love Windows' descriptive function names like
GetCurrentThreadId!.

ChangeLog:
* Have PostMessage call PostThreadMessage when hwnd is NULL




>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
(See attached file: postmessage.diff)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postmessage.diff
Type: application/octet-stream
Size: 666 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20021121/849921d8/postmessage.obj


More information about the wine-patches mailing list