🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CreateProcess() in Automation server freezes caller

#1385
From: Bob Gonder
Date: Tue, 11 Sep 2007 16:10
45 lines
2455 bytes
Wiebe Vos wrote:

>main application is completely blocked. No mouse- and keyboardactions are
>possible. (Other application are not affected...).
>
>How can I avoid this?

By processing those messages as well.

>//      do
>//        {
>//        Sleep(0);

	Sleep() is redundant.

>//        wRet = MsgWaitForMultipleObjects
>//              (
>//              1,                    // 1 handle to wait on
>//              &processInfo.hProcess, // the handle
>//              false,                // wake on any event
>//              INFINITE, // wait without timeout
>//              QS_PAINT | // wake on paint messages
>//              QS_SENDMESSAGE // or messages from other threads

Very much too restrictive. Use QS_ALLINPUT instead.

>//              );
>//        if ( wRet EQ (WAIT_OBJECT_0 + 1) )
>//          {
>//           while ( PeekMessage( &msg, 0, WM_PAINT, WM_PAINT, PM_REMOVE ) )
>//              DispatchMessage ( &msg );

Again, too restrictive.
You say mouse and keyboard are locked, that would
be because you are only looking at paint messages.
 Use general message pump.

       while ( PeekMessage( &msg, 0, 0,0, PM_REMOVE ) )
       {
	       TranslateMessage(&msg); 
	       DispatchMessage(&msg);
       };
>//          }
>//        }
>//      while ( wRet NEQ WAIT_OBJECT_0 );
Technical Details
Message-ID: <1eede39jn4jcrc9jpndbb8854q5f82lcnb@4ax.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.251.MISMATCH!news-out.readnews.com!transit4.readnews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46e69558$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ab74d8f845bd4978
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: CreateProcess() in Automation server freezes caller
Date: Tue, 11 Sep 2007 09:10:40 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <1eede39jn4jcrc9jpndbb8854q5f82lcnb@4ax.com>
References: <46e69558$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.83.116
X-Trace: newsgroups.borland.com 1189527161 69.69.83.116 (11 Sep 2007 09:12:41 -0700)
Lines: 48
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.251.MISMATCH!news-out.readnews.com!transit4.readnews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail