我想知道ShellExceute执行成功还是失败,请问怎么得到?
解决方案 »
- 请教 批量执行 bat文件的 方法,
- 急,Delphi中如何拦截键盘消息????给出代码,谢谢!
- 如何把jpeg还原成bmp?
- 想找个兼职的delphi开发工作,有朋友帮忙吗?
- 关于软件界面太大的问题!
- 网络截屏问题
- 如何读取硬盘ID CPU系列号,我试过很的例子,但总是只能在windows 2k可以,但换了98和me时就不能用了
- 一个多线程,挂起,唤醒,结束。创建的问题希望能回答正确
- 如何用delphi访问远程的mysql数据库,急急急急急急急急,在线等待,马上给分
- 怎样控制MDI窗口中的菜单在一定的情况下可用,请大家畅所欲言,方法越多越好
- 有谁知道PHOTOSHOP,FLASH这些软件是用什么工具开发的?
- ※※※★★醒目★★※※※:Delphi超级猛料CHM版发布
If the function fails, the return value is an error value that is less than or equal to 32. The following table lists these error values:Value Meaning
0 The operating system is out of memory or resources.
ERROR_FILE_NOT_FOUND The specified file was not found.
ERROR_PATH_NOT_FOUND The specified path was not found.
ERROR_BAD_FORMAT The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).
SE_ERR_ACCESSDENIED The operating system denied access to the specified file.
SE_ERR_ASSOCINCOMPLETE The filename association is incomplete or invalid.
SE_ERR_DDEBUSY The DDE transaction could not be completed because other DDE transactions were being processed.
SE_ERR_DDEFAIL The DDE transaction failed.
SE_ERR_DDETIMEOUT The DDE transaction could not be completed because the request timed out.
SE_ERR_DLLNOTFOUND The specified dynamic-link library was not found.
SE_ERR_FNF The specified file was not found.
SE_ERR_NOASSOC There is no application associated with the given filename extension.
SE_ERR_OOM There was not enough memory to complete the operation.
SE_ERR_PNF The specified path was not found.
SE_ERR_SHARE
var
StartInfo: TStartupInfo;
ProcInfo: TProcessInformation;
CmdLine: ShortString;
begin {Run a executable file and wait for it}
CmdLine := '"' + Filename + '" ' + Params; //Put the name of file between quotes, due to spaces in names of files in system Win9x
FillChar(StartInfo, SizeOf(StartInfo), #0);
with StartInfo do
begin
cb := SizeOf(StartInfo);
dwFlags := STARTF_USESHOWWINDOW;
wShowWindow := WinState;
end;
Result := CreateProcess(nil, PChar( String( CmdLine ) ), nil, nil, false,
CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil,
PChar(ExtractFilePath(Filename)),StartInfo,ProcInfo);
if Result then //Wait the finish of program
begin
WaitForSingleObject(ProcInfo.hProcess, INFINITE);
CloseHandle(ProcInfo.hProcess); //Free the Handles
CloseHandle(ProcInfo.hThread);
end;
end;