« Return to Thread: launching external app without flashing of cmd window

Re: launching external app without flashing of cmd window

by Elizabeth Smith :: Rate this Message:

Reply to Author | View in Thread

kksou wrote:

> When running php-gtk using php-win on windows, and launching external
> application from within php-gtk, one will always see a brief flashing of a
> cmd window.
>
> For those interested, I've posted a solution which we have been using for
> some time at:
> http://www.kksou.com/php-gtk2/articles/launch-external-app-in-winxp-without-the-flashing-of-cmd-window.php
>
> It basically make use of a freeware utility called cmdow utility from
> http://www.commandline.co.uk/cmdow/ that allows you to hide a command
> window. We find this a great tool for interfacing php-gtk with external
> applications, e.g. open a url in browser or playing a mp3 file using an
> external player.
>
> /kksou

That's kind of way overkill to launch a url/email address on windows
xp... and you have to use a non open-source extra application which
several antivirus programs flag...

The trick to launching an external url/email/even generic file on
windows is to use the start command (useful for launching files with the
registered program so you're not one of those annoying people who open
IE when I use firefox)

The trick to get around the flashing dos window is to use com and
WScript.Shell

$shell = new COM('WScript.Shell');
$shell->Run('cmd /c start "" "' . $url . '"', 0, FALSE);
unset($shell);

I've also found this is about three times as fast as exec or popen on XP

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 « Return to Thread: launching external app without flashing of cmd window