如何執行外部程式

有關Delphi 的語法, 程式, 等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

如何執行外部程式

文章 tim »

可以使用 ShellExecute 或是 WinExec
其中 ShellExecute 要 use ShellAPI,
WinExec 則是 Windows.
其語法如下:
ShellExecute 要傳入 (0,'OPEN', 指令, 參數, nil, 方式)
WinExec 則只要傳入 ( 指令(含參數), 方式)
即可

代碼: 選擇全部

      ShellExecute(0, PChar('OPEN'), 'ping.exe', '127.0.0.1 -t', nil, SW_SHOWNA); 
      WinExec( PChar('ping.exe 127.0.0.1 -t'),  SW_SHOWNA); 
多多留言, 整理文章, 把經驗累積下來.....
回覆文章