类似于用自己程序调用"记事本"的问题 ( 积分: 50 )

  • 主题发起人 MingWord
  • 开始时间
M

MingWord

Unregistered / Unconfirmed
GUEST, unregistred user!
这段代码的目的是查看注册表里有没有关于SQL Server的注册,有的话跳过,没有的话调用在文件目录下的Server目录中的Setup.exe安装桌面版SQL,这里我用的是WinExec,但是没有什么效果?大家看看是怎么回事?
procedure Create_Server;
var
ServerReg : Tregistry;
begin
try
ServerReg := Tregistry.Create;
ServerReg.RootKey := HKEY_LOCAL_MACHINE;
try
if not Serverreg.OpenKey('/software/microsoft/microsoft SQL Server/80',false) then
begin
if Application.MessageBox('服务器没有安装,请按确认键进行安装','提示',1) = 1 then
begin
Winexec('./Server/Setup.exe',SW_SHOW);
end;
end;
except
ShowMessage('未能完成安装,请手动安装 Microsoft SQL Server 2000');
Application.Terminate;
end;
finally
ServerReg.Free;
end;
end;
 
这段代码的目的是查看注册表里有没有关于SQL Server的注册,有的话跳过,没有的话调用在文件目录下的Server目录中的Setup.exe安装桌面版SQL,这里我用的是WinExec,但是没有什么效果?大家看看是怎么回事?
procedure Create_Server;
var
ServerReg : Tregistry;
begin
try
ServerReg := Tregistry.Create;
ServerReg.RootKey := HKEY_LOCAL_MACHINE;
try
if not Serverreg.OpenKey('/software/microsoft/microsoft SQL Server/80',false) then
begin
if Application.MessageBox('服务器没有安装,请按确认键进行安装','提示',1) = 1 then
begin
Winexec('./Server/Setup.exe',SW_SHOW);
end;
end;
except
ShowMessage('未能完成安装,请手动安装 Microsoft SQL Server 2000');
Application.Terminate;
end;
finally
ServerReg.Free;
end;
end;
 
Winexec('Server/Setup.exe',SW_SHOW);

Winexec(ExtractFilePath(application.exename)+'Server/Setup.exe',SW_SHOW);
 
to 余远源:行不通,根本就没有运行
 
Winexec(PChar(ExtractfilePath(ParamStr(0)) + 'Server/Setup.exe'),SW_SHOW);
 
谢谢zqw0117兄,运行成功.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
507
import
I
顶部