1、IIS或PWS虚拟目录
对于B/S版本的安装,可以用Install Shield创建IIS虚拟目录(在win2000下面可以用VirtualRoot.ADSI对象,Win98下面直接写注册表)。
//win2000下设置IIS虚拟目录
prototype SetVirtualRootbyNT(STRING, STRING);
//传入路径,虚拟目录名
function SetVirtualRootbyNT(szPath, szVirtualRoot)
VARIANT objVR;
begin
objVR = CreateObject("VirtualRoot.ADSI");
if !IsObject(objVR) then
return FALSE;
endif;
if (objVR.AddVirtualRoot("localhost", TARGETDIR + "\\" + szPath, szVirtualRoot) == 1) then
return TRUE;
else
return FALSE;
endif;
end;
//win98下设置PWS虚拟目录
prototype SetVirtualRootby9X(STRING, STRING);
//传入路径,虚拟目录名
function SetVirtualRootby9X(szPath, szVirtualRoot)
VARIANT objVR;
STRING szKey,szName;
begin
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
//判断是否安装PWS或IIS
if (RegDBKeyExist ("Software\\Microsoft\\InetStp") < 0) then
MessageBox("您需要建立PWS或者是IIS服务", INFORMATION);
return FALSE;
endif;
szKey = "System\\CurrentControlSet\\Services\\W3SVC\\Parameters\\Virtual Roots";
szName = "/" + szVirtualRoot; //虚拟目录名为EcreateRestaurant
if (RegDBSetKeyValueEx (szKey , szName , REGDB_STRING , TARGETDIR + szPath + ",,201" , -1 ) < 0 ) then
return FALSE;
endif;
return TRUE;
end;
2、删除COM组件
prototype DeleteCOM(STRING); //传入COM组件名
function DeleteCOM(szCOMAppName)
VARIANT objComManage;
NUMBER nvOS;
STRING svResult;
begin
if szCOMAppName = "" then
return TRUE;
endif;
if (GetSystemInfo ( OS , nvOS , svResult )!= 0) then
return FALSE;
endif;
if (nvOS == IS_WINDOWSNT) then
objComManage = CreateObject("ComManage.DeleteCOM");
if !IsObject(objComManage) then
return FALSE;
endif;
if objComManage.IsExistsCOMApp(szCOMAppName) then
objComManage.StopCOMApp(szCOMAppName);
objComManage.DeleteCOMApp(szCOMAppName);
endif;
return TRUE;
endif;
end;
3、注册Delphi下的sockSrv服务及中间件服务器
以下函数仅用于Delphi下开发的应用程序
//安装套接字服务器
prototype InstallSocketSrv(STRING); //传入路径
function InstallSocketSrv(szPath)
STRING szSockSrv;
NUMBER nResult;
begin
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
nResult = RegDBKeyExist("\\SYSTEM\\CurrentControlSet\\Services\\GraspSocktSrvr");
if nResult < 0 then
//szSockSrv = TARGETDIR + "\\" + szPath;
if (LaunchAppAndWait (szPath, "/install", WAIT) < 0) then
return TRUE;
endif;
endif;
return TRUE;
end;
//注册应用服务器
prototype InstallAppServer(STRING);
//传入路径
function InstallAppServer(szPath)
STRING szKey;
NUMBER Result;
begin
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
//注册CLASS
szKey = "\\Software\\CLASSES\\CLSID\\" + @U_Reg_AppClass + "\\LocalServer32";
if (RegDBCreateKeyEx (szKey, '') >= 0) then
RegDBSetKeyValueEx (szKey, '', REGDB_STRING, szAppPath, -1);
endif;
//注册TLB
szKey = "\\Software\\CLASSES\\TypeLib\\" + @U_Reg_AppTLB + "\\1.0\\0\\win32";
if (RegDBCreateKeyEx (szKey, '') >= 0) then
RegDBSetKeyValueEx (szKey, '', REGDB_STRING, szAppPath, -1);
endif;
//注册TLB
szKey = "\\Software\\CLASSES\\TypeLib\\" + @U_Reg_AppTLB + "\\1.0\\HELPDIR";
if (RegDBCreateKeyEx (szKey, '') >= 0) then
RegDBSetKeyValueEx (szKey, '', REGDB_STRING, TARGETDIR, -1);
endif;
end;