Install Shield制作安装包技巧(注册篇)

王朝other·作者佚名  2006-01-31
窄屏简体版  字體: |||超大  

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;

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航