If you try to launch GUI apps from a service in Vista, you'll have lots of trouble. As a security feature, Vista mediates the interaction of services with the desktop using 'Interactive Services Detection'.
That means, if you are running PHP as a module of an Apache service, you won't be able to launch GUI apps using any method. This kind of thing just won't work:
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("notepad.exe", 7, false);
So, if you want to use Apache/PHP as a proxy for launching GUI apps, you'll need to run Apache as a console application.
First, if Apache is already installed as a service, you'll need to set it's startup type to "manual" using the services snap-in. (%SystemRoot%\system32\services.msc) Search for Services in the start menu search box.
Then add a shortcut to C:\apache\bin\httpd.exe (or wherever Apache is installed) to your Startup folder, and set that shortcut to start minimized. You can use an app like TrayIt! to force Apache down into the system tray.
Then use any of the methods outlined on the PHP website and you will be able to open a Windows application from PHP and see it's GUI.
システムプログラムの実行
- 導入
- インストール/設定
- 定義済み定数
- プログラム実行関数
- escapeshellarg — シェル引数として使用される文字列をエスケープする
- escapeshellcmd — シェルのメタ文字をエスケープする
- exec — 外部プログラムを実行する
- passthru — 外部プログラムを実行し、未整形の出力を表示する
- proc_close — proc_open で開かれたプロセスを閉じ、 そのプロセスの終了コードを返す
- proc_get_status — proc_open で開かれたプロセスに関する情報を取得する
- proc_nice — 現在のプロセスの優先度を変更する
- proc_open — コマンドを実行し、入出力用にファイルポインタを開く
- proc_terminate — proc_open でオープンされたプロセスを強制終了する
- shell_exec — シェルによりコマンドを実行し、文字列として出力全体を返す
- system — 外部プログラムを実行し、出力を表示する
プログラムの実行
Joe Engel
01-Jan-2009 07:46
01-Jan-2009 07:46
