🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Program lockup waiting for messages

#8200
From: Jeff
Date: Mon, 15 Nov 2004 17:48
28 lines
2132 bytes
Thanks, I managed to get it to work with SendMessageTimeout(). I just set a 
short timeout.

"Dennis Jones" <nospam@bogus.com> wrote in message 
news:4198e62f@newsgroups.borland.com...
>
> "Jeff" <Jeff@nospam.com> wrote in message
> news:4198d752$1@newsgroups.borland.com...
>> Sure, here is one message being sent:
>> void __fastcall TfrmMain::btnStartClick(TObject *Sender)
>> {
>>     SendMessage(WinHandle, WM_STARTSCRIPT, 0, 0);
>> }
>
> There's your problem(s).
>
> 1. SendMessage() doesn't return until the message has been handled.
> 2. VCL event handlers (like your button click handler) are handled in the
> main VCL thread, and if an event handler blocks, everything grinds to a
> halt.
>
> You will probably want to create a separate thread that sends the message
> and waits for the reply.  Or, alternatively, if your app does not have to
> wait until the caller is done before continuing, use PostMessage instead.
>
> - Dennis
>
> 
Technical Details
Message-ID: <4198ec01$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4198d4ba$1@newsgroups.borland.com> <4198d657@newsgroups.borland.com> <4198d752$1@newsgroups.borland.com> <4198e62f@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e97b309831fdfaaf
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Jeff" <Jeff@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4198d4ba$1@newsgroups.borland.com> <4198d657@newsgroups.borland.com> <4198d752$1@newsgroups.borland.com> <4198e62f@newsgroups.borland.com>
Subject: Re: Program lockup waiting for messages
Date: Mon, 15 Nov 2004 10:48:58 -0700
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 206.104.31.204
Message-ID: <4198ec01$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1100540929 206.104.31.204 (15 Nov 2004 09:48:49 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsgate.cistron.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail