🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4324

Re: HWND_BROADCAST handle

#4324
From: Andrew Fedoseev
Date: Wed, 15 Feb 2006 07:53
51 lines
2420 bytes
 It worked, thank you.

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> �������/�������� � ��������
���������: news:43f24ba8@newsgroups.borland.com...
>
> "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: <43f2dcd8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43f23f8c@newsgroups.borland.com> <43f24ba8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,acf9898819c81cc3
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: "Andrew Fedoseev" <andrewfx@mail.ru>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43f23f8c@newsgroups.borland.com> <43f24ba8@newsgroups.borland.com>
Subject: Re: HWND_BROADCAST handle
Date: Wed, 15 Feb 2006 10:53:22 +0300
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 212.15.100.130
Message-ID: <43f2dcd8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1139989720 212.15.100.130 (14 Feb 2006 23:48:40 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail