现在在家,明天发email到[email protected],may be i can help you
解决方案 »
- 额的神呀,这个代段在XE2的FireMonkey中怎么会无效了?
- 哪位有XPMenu FOR D7 ,我在这www.playicq.com了个,但用于程序中会出错,3Q
- 在线等待: U盘永久删除的文件如何恢复?
- 怎么实现向后查找数据库中记录?
- 书山有路勤为径,学海无崖苦做舟!!!
- 刚刚答辩完,教授们提的问题太无厘头,郁闷!
- 怎样使DBGRID的每个COLUMN宽度,自动适应其实际数值的长度???
- 请问:谁知道Delphi 5 Enterprise Edition的序列号和Key?
- 如何操作cxGrid过滤出来的数据集?
- 关于MEMO控件的问题!请大神指教!
- 怎样带子目录一起拷贝,有现成函数源码最好!!!!!!!!!!!!!
- 怎样带路径的列出win2000下面运行的进程(一定要带路径哟),并对其进行管理!难道这么没有人会嘛??!!我都问了好些遍了
//***************************************************** function ExecFileAndWait(const aCmdLine: String; Hidden, doWait: Boolean): Boolean;
var
StartupInfo : TStartupInfo;
ProcessInfo : TProcessInformation;
begin
{setup the startup information for the application }
FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
with StartupInfo do
begin
cb:= SizeOf(TStartupInfo);
dwFlags:= STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
if Hidden
then wShowWindow:= SW_HIDE
else wShowWindow:= SW_SHOWNORMAL;
end; Result := CreateProcess(nil,PChar(aCmdLine), nil, nil, False,
NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInfo);
if doWait then
if Result then
begin
WaitForInputIdle(ProcessInfo.hProcess, INFINITE);
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
end;
end; procedure TForm1.Button1Click(Sender: TObject);
begin
ExecFileAndWait('notepad.exe',false,true);
end; //With ShellExecuteEx:
//***************************************************** uses shellapi; {...} procedure TForm1.Button1Click(Sender: TObject); Var
exInfo: TShellExecuteInfo;
exitcode: DWORD;
Begin
FillChar( exInfo, Sizeof(exInfo), 0 );
With exInfo Do Begin
cbSize:= Sizeof( exInfo ); // required!
fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
Wnd := Handle; // forms handle
lpVerb:= 'open';
lpFile:= Pchar('notepad' );
nShow := SW_SHOWNORMAL
End;
If ShellExecuteEx( @exInfo ) Then Begin
While GetExitCodeProcess( exinfo.hProcess, exitcode )
and (exitcode = STILL_ACTIVE)
Do
Application.Processmessages;
CloseHandle( exinfo.hProcess );
End
Else
ShowMessage(SysErrorMessage( GetLastError ));
showmessage('ended');
end;