🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Creating Message Queue For a thread

#14804
From: Burak ulutoprak
Date: Tue, 29 Jul 2003 11:58
36 lines
2396 bytes
Hi,i have a problem with messages and threads.I am using threads which are
communicating between each other by sending messages. The handling of
messages is like that.
while(1)
 while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
              Dispatch(&msg);
}



( I change the definition of BEGIN_MESSAGE_MAP to
#define MY_BEGIN_MESSAGE_MAP virtual void __fastcall Dispatch(tagMSG
*Message) { switch  (Message->message)    {
which causes problem with threads and I have no problem with that part. )


Here when GetMessage takes a message, dispatch function cannot return
immidiately, becaouse message handling functions need user intraction in
order to return ,which causes dispatch method to return very late. So when
GetMessage function looks for another message , it does not return even if
more messages are sent. Only  messages after GetMessage Function is invoked
can be handled.
The problem is I think there is no message queue, so the messages coming
when processing others are not pooled.
I know that PeekMessage functions return true for lost messages.

Win32 SDK says that
 "all threads are created initially without a message queue. The system
creates a thread's message queue only when the thread makes its first call
to one of the Win32 API User or GDI functions."
So does first call to GetMessage function creates a message queue. If yes
why I lose messages caming in handling period, if no how can I create a
message queue for a thread.

Thanks for help
Technical Details
Message-ID: <3f27b1dd$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!newsfeed.news2me.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,157dc011cd880c13,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-30 05:03:14 PST
From: "Burak ulutoprak" <bulutoprak@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Creating Message Queue For a thread
Date: Tue, 29 Jul 2003 14:58:30 +0300
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 144.122.180.3
Message-ID: <3f27b1dd$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1059566045 144.122.180.3 (30 Jul 2003 04:54:05 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail