🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Retrieving Windows Messages without window

#7982
From: Sam
Date: Thu, 02 Dec 2004 22:11
29 lines
1944 bytes
Remy Lebeau (TeamB) wrote:
> 
>     HWND FWnd;
> 
>     void __fastcall TMyThread::Execute()
>     {
>         MSG msg;
>         FWnd = AllocateHWnd(WndProc);
>         try
>         {
>             while( ::GetMessage(&msg, FWnd, 0, 0) > 0 )
>             {
>                 ::TranslateMessage(&msg);
>                 ::DispatchMessage(&msg);
>             }
>         }
>         __finally {
>             DeallocateHWnd(FWnd);
>         }
>     }
> 

If my memory serves me well, I think 'AllocateHWnd' calls
'MakeObjectInstace' which is not thread safe. So it is
best to call 'AllocateHWnd' and 'DeallocateHWnd' from
the main thread.

-- 
Please remove "sam_" from email address.
Technical Details
Message-ID: <41af92f0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41adeee2@newsgroups.borland.com> <41adf778@newsgroups.borland.com> <41ae1698@newsgroups.borland.com> <41ae25a6$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5ff06343caccb767
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 03 Dec 2004 00:11:08 +0200
From: Sam <sam_sakarab@yahoo.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Retrieving Windows Messages without window
References: <41adeee2@newsgroups.borland.com> <41adf778@newsgroups.borland.com> <41ae1698@newsgroups.borland.com> <41ae25a6$1@newsgroups.borland.com>
In-Reply-To: <41ae25a6$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 62.38.248.110
Message-ID: <41af92f0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1102025456 62.38.248.110 (2 Dec 2004 14:10:56 -0700)
Lines: 30
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail