On 26/07/07, Robert May <[EMAIL PROTECTED]> wrote: > On 26/07/07, Marc Nürnberger <[EMAIL PROTECTED]> wrote: > > Hmmmm... I found a strange behavior after adding some "debugging" prints. > > The delay occurs when the last command is executed. That `links.html` > > one. Everything works fine up to that point. But that's only the case > > when I use the GUI version. When using the console version that command > > runs without delay. Does somebody know why that occurs? > > I have no idea what might be causing that. I can't immediately see > how Win32::GUI could be at fault, but I am never surprised.
OK, I think I can explain it now - and it looks like a problem with perl, and not Win32::GUI - I'll need do do a little bit more investigation, and if I'm right I'll work on a fix for perl. > I tried using > system "start temp.html"; > instead, and I see the delay you're taking about. I can get rid of > the delay by doing > undef $main; > before making the system call 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); I'll continue my investigation. Regards, Rob. [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?)] ------------------------------------------------------------------------- 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/