The documentation says:
[When passing NULL for a handle, which doesn't refer to variant Null, but actually the value 0
]:
The function behaves like a call to PostThreadMessage with the dwThreadId parameter set to the identifier of the current thread.
So, it has a distinct meaning to post messages to 0
, and you should not just allow that if you actually want to fire messages into oblivion. If that's the case, you'd rather check if the handle is 0
and not post the message at all.
Note, though, that is it perfectly legit to create a window, even in a non-visual application. Handles like this are for sending messages to. They don't necessarily point to a visible window. Actually, that is just what AllocateHWND is for. It is used for non visual controls (like TTimer) that need to be able to recieve messages after all.