🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: HWND_BROADCAST doesn�t work!

#6010
From: Remy Lebeau (TeamB)
Date: Fri, 17 Jun 2005 22:12
37 lines
2313 bytes
"Alexandre S�" <alexandre@daccord.com.br> wrote in message
news:42b3322d$1@newsgroups.borland.com...

> A broadcast message is not working properly.
> But if I use...
>      PostMessage(hWindow, WM_USER, 0, 0L);
>      or
>      PostMessage(NULL, WM_USER, 0, 0L);
> instead of...
>      PostMessage(HWND_BROADCAST, WM_USER, 0, 0L);
> the message is peeked.

The only way that would happen is if your code is not setting up a top-level
window that is capable of receiving broadcasts in the first place.  Your
other uses of PostMessage() send the message to a specific window or a
specific thread (PostMessage(NULL, ...) is the same as calling
PostThreadMessage(GetCurrentThreadId(), ...)) without any broadcasting,
which explains why the peeking works fine for them.

> static LRESULT WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)

That is not the proper signature for a window procedure.  You left out the
calling convention.  The default calling convention is __cdecl when no
convention is specified in the code.  A window procedure needs to use the
__stdcall convention, ie:

    LRESULT __stdcall WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
lParam)

Or:

    LRESULT CALLBACK WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM
lParam)


Gambit
Technical Details
Message-ID: <42b34cfc$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42b30d0a$1@newsgroups.borland.com> <42b317d0$1@newsgroups.borland.com> <42b31b9a@newsgroups.borland.com> <42b3322d$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,af4f253f03c4e6fb
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42b30d0a$1@newsgroups.borland.com> <42b317d0$1@newsgroups.borland.com> <42b31b9a@newsgroups.borland.com> <42b3322d$1@newsgroups.borland.com>
Subject: Re: HWND_BROADCAST doesn�t work!
Date: Fri, 17 Jun 2005 15:12:43 -0700
Lines: 39
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: <42b34cfc$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1119046908 68.69.17.41 (17 Jun 2005 15:21:48 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail