Delphi函数转到Inno Setup函数,在线等(100分)

  • 主题发起人 主题发起人 liujiaqi
  • 开始时间 开始时间
L

liujiaqi

Unregistered / Unconfirmed
GUEST, unregistred user!
下面的代码是我在Delphi里面写的,现在要把这个函数写在Inno Setup里面,
有很多类型或函数都不知道怎么替换, 请大家帮帮忙,分数也不多, 全部给出

//得到注册返回值
function WinExecAndWait32(FileName: string;
Visibility: Boolean): integer;
var
zAppName: array[0..512] of char;
//存放应用程序名
StartupInfo: TStartupInfo;
ProcessInfo: TProcessInformation;
exitCode: Dword;
aVisibility: integer;
begin
StrPCopy(zAppName, FileName);
FillChar(StartupInfo, Sizeof(StartupInfo), #0);
//给StartupInfo结构体赋值
StartupInfo.cb := Sizeof(StartupInfo);
StartupInfo.dwFlags := STARTF_USESHOWWINDOW;
if Visibility then
aVisibility := 1
else
aVisibility := 0;
StartupInfo.wShowWindow := aVisibility;
//调用CreateProcess 创建进程,执行指定的可执行文件
if not CreateProcess(nil, zAppName, nil, nil, false
, CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS
, nil, nil, StartupInfo, ProcessInfo) then
Result := -1
else
begin
//等待可执行文件退出
WaitforSingleObject(ProcessInfo.hProcess, INFINITE);
//得到进程终止状态码
GetExitCodeProcess(ProcessInfo.hProcess, exitCode);
result := Exitcode;
end;
end;
 
沒人回答麼
 
复杂了些
 
此类函数,INNO本身就内置支持有了。。可以直接用
function Exec(const Filename, Params, WorkingDir: String;
const ShowCmd: Integer;
const Wait: TExecWait;
var ResultCode: Integer): Boolean;
function ExecAsOriginalUser(const Filename, Params, WorkingDir: String;
const ShowCmd: Integer;
const Wait: TExecWait;
var ResultCode: Integer): Boolean;
function ShellExec(const Verb, Filename, Params, WorkingDir: String;
const ShowCmd: Integer;
const Wait: TExecWait;
var ErrorCode: Integer): Boolean;
function ShellExecAsOriginalUser(const Verb, Filename, Params, WorkingDir: String;
const ShowCmd: Integer;
const Wait: TExecWait;
var ErrorCode: Integer): Boolean;
 
接受答案了.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
836
import
I
后退
顶部