Article View: borland.public.cppbuilder.nativeapi
Article #8197Re: Program lockup waiting for messages
From: Dennis Jones
Date: Mon, 15 Nov 2004 17:23
Date: Mon, 15 Nov 2004 17:23
21 lines
1668 bytes
1668 bytes
"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:
<4198e62f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4198d4ba$1@newsgroups.borland.com> <4198d657@newsgroups.borland.com> <4198d752$1@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: "Dennis Jones" <nospam@bogus.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4198d4ba$1@newsgroups.borland.com> <4198d657@newsgroups.borland.com> <4198d752$1@newsgroups.borland.com> Subject: Re: Program lockup waiting for messages Date: Mon, 15 Nov 2004 09:23:58 -0800 Lines: 23 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 204.200.27.7 Message-ID: <4198e62f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100539439 204.200.27.7 (15 Nov 2004 09:23:59 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail