简单问题:请教如何调用一个可执行文件?是用Winexec吗?并且要求该程序只能运行一次呢?能给个例子吗?
解决方案 »
- 请问如何启动一个程序,并获取这个程序的句柄?
- 关于fastreport 隐藏零值的问题!
- 请教大家一个问题.如何在dbgrid的最后一行做一个数据统计.
- 如何编程得到远程连接过来的机器的IP地址?
- 是一个老问题了,虽然很简单,但还是没有人会回答:)
- 接口该如何使用?
- Delphi 用的B/S结构,请问一般用什么方式来控制数据库的事务?
- 关于主从表的问题
- 我初学我要求师谁能愿意受我一拜!
- delphi中用DBedit获取数据库中date类型时间,如何和系统时间比较获得差值
- 调用OpenFileName这个API,怎么可以获得多选文件的列表?
- 如何使用ADOQuery+Dbgrid根据两个主表显示一个从表里对应的数据
bShowWindow: Boolean; PI: PProcessInformation): Boolean;
var
StartupInfo : TStartupInfo;
ProcessInformation: TProcessInformation;
begin
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
with StartupInfo do
begin
cb := SizeOf(TStartupInfo);
dwFlags := STARTF_USESHOWWINDOW;
if bShowWindow then
wShowWindow := SW_NORMAL
else
wShowWindow := SW_HIDE;
end;
Result := CreateProcess(nil, PChar(Command),
nil, nil, True, NORMAL_PRIORITY_CLASS, nil, nil,
StartupInfo, ProcessInformation);
if not Result then
Exit;
if bWaitExecute then
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
if Assigned(PI) then
Move(ProcessInformation, PI^, SizeOf(ProcessInformation));
end;
调用示例
MyExecute('C:\WINNT\system32\net.exe send huo aa',true,true,nil);