Article View: borland.public.cppbuilder.nativeapi
Article #4323Re: HWND_BROADCAST handle
From: Remy Lebeau (TeamB)
Date: Tue, 14 Feb 2006 21:32
Date: Tue, 14 Feb 2006 21:32
44 lines
2176 bytes
2176 bytes
"Andrew Fedoseev" <andrewfx@mail.ru> wrote in message
news:43f23f8c@newsgroups.borland.com...
> The problem is that i cant catch this message if it has been
> sent with HWND_BROADCAST parameter in SendMessage (...)
> or PostMessage(...) function.
Yes, you can. See below.
> The mainform class of receiving application is populated with
> begin_message macros (i used WndProc functions as well) but
> no result comes out of it.
That is because you are catching the message in the wrong window. You need
to catch it from the TApplication window, not the TForm window. Call the
TApplication::HookMainWindow() method in order to catch messages that are
processed by the TApplication window, ie:
__fastcall TForm1::TForm1(TComponent *Owner)
: TForm(Owner)
{
Application->HookMainWindow(MyAppHook);
}
__fastcall TForm1::TForm1(TComponent *Owner)
: TForm(Owner)
{
Application->UnhookMainWindow(MyAppHook);
}
bool __fastcall TForm1::MyAppHook(TMessage &Message)
{
if( Message.Msg == WM_MY_MESSAGE )
{
// ...
return true;
}
else
return (Message.Msg == WM_INITDIALOG);
}
Gambit
Technical Details
Message-ID:
<43f24ba8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<43f23f8c@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,acf9898819c81cc3 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <43f23f8c@newsgroups.borland.com> Subject: Re: HWND_BROADCAST handle Date: Tue, 14 Feb 2006 13:32:19 -0800 Lines: 46 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <43f24ba8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1139952552 68.69.17.41 (14 Feb 2006 13:29:12 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail