调用外部程序时,怎样传递参数(200分)

L

leanyee

Unregistered / Unconfirmed
GUEST, unregistred user!
调用外部程序时,怎样传递参数
 
通过application.param????(数字)<br>application.param????(0)返回当前运行程序的路径及文件名<br>
 
直接加在后面:WinExec(pchar('nbtstat -a 192.168.0.1'),SW_SHOW)
 
或用shellexecute,那个功能更强些<br>HINSTANCE ShellExecute(<br>&nbsp; &nbsp; HWND hwnd, // handle to parent window<br>&nbsp; &nbsp; LPCTSTR lpOperation, // pointer to string that specifies operation to perform<br>&nbsp; &nbsp; LPCTSTR lpFile, // pointer to filename or folder name string<br>&nbsp; &nbsp; LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters <br>&nbsp; &nbsp; LPCTSTR lpDirectory, // pointer to string that specifies default directory<br>&nbsp; &nbsp; INT nShowCmd // whether file is shown when opened<br>&nbsp; &nbsp;);
 
首先要外部程序支持命令行参数,如果不支持是不能传的。
 
我没有表达清楚,我的意思是我自己的程序再调用此程序,<br>还要传递一些参数过去,以显示不同的结果,如同ie的多<br>窗口显示的效果
 
顶部