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;
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;