Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2006 Oct : Posting a message to Hwnd=0

www.cryer.info
Managed Newsgroup Archive

Posting a message to Hwnd=0

Subject:Posting a message to Hwnd=0
Posted by:"Mike Warren" (miwa-not-this-b..@or-this-csas.net.au)
Date:22 Oct 2006 03:40:34

Is it safe to post a message to a handle of 0? The WinAPI help that
comes with D7 says the a handle of NULL posts to the current thread as
if it was a PostThreadMessage.

I know nothing in my program will respond to the custom messages and
would rather not do this every time if it's not necessary.

if HMicWin <> 0 then
  PostMessage(HMicWin, MyCustomMessage...

HMicWin is a function that calls FindWindow.

If the program I'm posting these messages to (also mine) is not running
HMicWin will be 0.

Can I safely do this?

PostMessage(HMicWin, MyCustomMessage...

knowing that HMicWin may sometimes be 0.

--
Mike

Replies:

www.cryer.info
Managed Newsgroup Archive