On Sat, 28 Jul 2007, Robert May wrote:
> On 28/07/07, Jan Dubois <[EMAIL PROTECTED]> wrote:
> > CreateProcess() will return and not wait for command.com/cmd.exe to
> > initialize. Upon return win32_spawnvp() will call win32_msgwait(),
> > which should continue to pump the message loop until the external
> > process ends.
>
> That's what's supposed to happen, but in AS build 819 on win98 (that's
> all I have access to this weekend), I have to change the flags to
> MsgWaitForMultipleObjects from QS_ALLEVENTS to
> QS_ALLEVENTS|QS_SENDMESSAGE to get it to pump the sent WM_DDE_INITIATE
> message.

Alright, I looked at the code again, and the real problem is:
win32_msgwait() doesn't actually dispatch any messages; it only
processes (via win32_async_check()) WM_TIMER and WM_USER messages sent
to hwnd NULL.

The whole reason for *not* running a message pump is to allow an
embedding application to use PostThreadMessage() too. If we ran a
message pump, we wouldn't know what to do with messages sent to hwnd
NULL that we are not expecting.

But given the problem you discovered with DDE initiation while waiting
for system() to return, I think win32_async_check() needs to run a
message pump. Given that the whole PostThreadMessage() mechanism is too
brittle for GUI threads anyways (you cannot avoid losing messages), I
doubt anyone is using it while also embedding Perl.

While looking at this issue I noticed that even though we are using a
message-only window on Windows 2000 and later, we are not actually
expecting anybody else to dispatch the messages to a wndproc; we always
try to snatch them out of the queue via PeekMessage(). So we still
inherit the brittleness of the PostThreadMessage() mechanism.

I'll see if I can come up with a patch for both issues some time later
next week.

Cheers,
-Jan

PS: Please let me know if you happen to know a mechanism to create a
    message-only window on 98/NT (a window that is not top-level and
    will not receive broadcast messages). If this were possible, then we
    could get rid of PostThreadMessage() completely.



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to