我的程序中用到函数DeleteFile和WinExec两个函数。
用WinExec时,需要在Uses中添加 Uses WinProcs
但一添加它时编译到DeleteFile就出错。
不添加时WinExec 就编译不过去。
请问如何解决这个问题?
用WinExec时,需要在Uses中添加 Uses WinProcs
但一添加它时编译到DeleteFile就出错。
不添加时WinExec 就编译不过去。
请问如何解决这个问题?
解决方案 »
- 如何将插入oracle数据库的number字段的数值保留小数点后两位?
- 进程问题
- 如何将“11/08/2005-RC410-SB450-PTRC-GC-00”字符串当遇到“/”“-”时,把它分开存到其它字符串变量中???
- 窗体之间传值
- 在界面上的控件如Edit控件,要用鼠标来自由拖动,一般采用什么做法比较合适
- 一个很傻的问题,可是我就是不会.急急急!!!
- Borlandor(五角▲大民)再請進!
- 有人告诉我,csdn是高手汇聚的地方,是吗?
- 请问那里有Delphi语言参考手册
- bde初始化失败,why???????????????????????
- 怎么能够让Delphi6编译出来的代码最小。。。。。
- 一个常识性的问题!!!
//执行程序并等待结束
function TF_Export.WinExecAndWait32(FileName:String; Visibility :
integer):Integer;
var
zAppName:array[0..512] of char;
zCurDir:array[0..255] of char;
WorkDir:String;
StartupInfo:TStartupInfo;
ProcessInfo:TProcessInformation;
Res: Cardinal;
begin
StrPCopy(zAppName,FileName);
GetDir(0,WorkDir);
StrPCopy(zCurDir,WorkDir);
FillChar(StartupInfo,Sizeof(StartupInfo),#0);
StartupInfo.cb := Sizeof(StartupInfo); StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow := Visibility;
if not CreateProcess(nil,
zAppName, { pointer to command line string }
nil, { pointer to process security attributes }
nil, { pointer to thread security attributes }
false, { handle inheritance flag }
CREATE_NEW_CONSOLE or { creation flags }
NORMAL_PRIORITY_CLASS,
nil, { pointer to new environment block }
nil, { pointer to current directory name }
StartupInfo, { pointer to STARTUPINFO }
ProcessInfo) then Result := -1 { pointer to PROCESS_INF }
else begin
WaitforSingleObject(ProcessInfo.hProcess,INFINITE);
GetExitCodeProcess(ProcessInfo.hProcess,Res);
Result := Res;
end;
end;
//调用
if WinExecAndWait32(Str1,SW_Show) = -1 then
showmessage('失败');
而且我按你说的方法编译都没问题。
最好不用 WinProcs 单元。在检查DeleteFile函数参数有无错误。
或者 用 SysUtils.DeleteFile()其实,用了 Windows 单元,可不再用 WinProcs 单元。