🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: PostMessage() with HWND_BROADCAST not working.

#16808
From: Remy Lebeau (TeamB)
Date: Thu, 24 Apr 2003 19:49
29 lines
2324 bytes
"Jeff Douglass" <.> wrote in message
news:3ea8274c$1@newsgroups.borland.com...

> The message is simply defined as
> #define THE_MESSAGE (WM_USER + 3332)

I would suggest you consider having a look at the RegisterWindowMessage()
function.  The one gotcha with hard-coded message IDs is that you never know
when someone else is using the same ID for their own stuff.  Especially in a
scenerio where you're broadcasting the message to everyone.  Using
RegisterWindowMessage() ensures you have a unique value that only you know
how to interpret (and anyone else specifically written to directly support
your message).

> The only thing I can think is the problem is that the startup
> window is not a "top level window"

Very possibly.  VCL forms are not stand-alone.  They are actually children
of the hidden global TApplication window, which is the true top-level window
for the program.  You will probably need to assign an event handler to the
TApplication::OnMessage event in order to intercept your broadcast
correctly.  Otherwise, you'll have to override the form's CreateParams()
method to reassign the owner window (in API terms, not VCL) to be the main
Desktop window instead.  That might have other side-effects on how the VCL
form behaves, though.


Gambit
Technical Details
Message-ID: <3ea841b8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3ea817c4@newsgroups.borland.com> <3ea8221a$3@newsgroups.borland.com> <3ea8274c$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a275b46d2460f43e
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-24 13:04:10 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ea817c4@newsgroups.borland.com> <3ea8221a$3@newsgroups.borland.com> <3ea8274c$1@newsgroups.borland.com>
Subject: Re: PostMessage() with HWND_BROADCAST not working.
Date: Thu, 24 Apr 2003 12:49:08 -0700
Lines: 31
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: 207.175.226.26
Message-ID: <3ea841b8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1051214264 207.175.226.26 (24 Apr 2003 12:57:44 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail