中国开发网: 论坛: Delphi/BCB: 贴子 572715
pcplayer: 自己用代码注册 COM / OCX / DLL
uses ShellAPI

function ExecAndWait(const ExecuteFile, ParamString : string):
boolean;
var
SEInfo: TShellExecuteInfo;
ExitCode: DWORD;
begin
FillChar(SEInfo, SizeOf(SEInfo), 0);
SEInfo.cbSize := SizeOf(TShellExecuteInfo);
with SEInfo do begin
fMask := SEE_MASK_NOCLOSEPROCESS;
Wnd := Application.Handle;
lpFile := PChar(ExecuteFile);
lpParameters := PChar(ParamString);
nShow := SW_HIDE;
end;
if ShellExecuteEx(@SEInfo) then
begin
repeat
Application.ProcessMessages;
GetExitCodeProcess(SEInfo.hProcess, ExitCode);
until (ExitCode <> STILL_ACTIVE) or Application.Terminated;
Result:=True;
end
else Result:=False;
end;

===============================

利用以上函数:

procedure TForm1.Button1Click(Sender: TObject);
begin
ExecAndWait('regsvr32','/s' + 'F:\test\test.dll');
end;

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录