On Sat, 28 Jul 2007, Robert May wrote:
> Here's what happens - the call to system, or using backticks, makes a
> request to the OS to find the program associated with *.html files,
> launch it (if it isn't already running) and ask it to open the html
> file.
> 
> As part of the process of finding out if there is already a running
> program of the right type the OS may attempt (depending on the program
> and it's associated registry values) to use a technique called DDE -
> if it does try this mechanism, the in broadcasts a WM_DDE_INITIATE
> message to every top-level window in the system, and waits for each
> one to reply.  In this case we have a top-level window ($main), and so
> the system sends this message to our top level window, but because we
> are not in a message loop we never respond, and the system has to wait
> for a timeout (typically about 30 seconds).
> 
> The code in perl behind the system call  *should* be handling
> WM_DDE_INITIATE messages, but is not (at least not in the version of
> perl you are running)
>
> There are 2 ways that I can see to resolve this for now.
> (1) As I already suggested do 'undef $main' before making the shell
> call - this destroys our window so we no longer have a top level
> window.
> (2) Use ShellExecute, which spins its own internal message loop until
> the DDE initialisation is complete.  Something like this:
>  $main->ShellExecute("", "temp.html", "", "", SW_SHOW);

This does not sound plausible to me:  system("start foo.html") will
end up calling CreateProcess() on command.com/cmd.exe because start
is an intrinsic shell command and will not be found on the PATH.

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.

But even if it didn't, the "start" command is just a commandline
interface to the ShellExecuteEx() function called from cmd.exe,
so it wouldn't be any different from your solution (2) above.

Of course all bets are off if you have a start.exe/start.com on the PATH.

> [Jan, I don't know if you read all the messages to this list, but know
> you are subscribed - I'll follow-up to P5P with a report (and patch?)]

I only browse the subject lines.  Please CC me explicitly if you want
to make sure I read a particular message.

Cheers,
-Jan


-------------------------------------------------------------------------
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