收藏 分销(赏)

installshield学习重点笔记专业资料.doc

上传人:精*** 文档编号:2954201 上传时间:2024-06-12 格式:DOC 页数:40 大小:948.04KB
下载 相关 举报
installshield学习重点笔记专业资料.doc_第1页
第1页 / 共40页
installshield学习重点笔记专业资料.doc_第2页
第2页 / 共40页
installshield学习重点笔记专业资料.doc_第3页
第3页 / 共40页
installshield学习重点笔记专业资料.doc_第4页
第4页 / 共40页
installshield学习重点笔记专业资料.doc_第5页
第5页 / 共40页
点击查看更多>>
资源描述

1、安装前设立界面公司标记在OnBegin函数中,添加如下脚本:SetTitle(IFX_PRODUCT_NAME + -Infomedia,0,BACKGROUNDCAPTION);安装中安装.netRegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); if(RegDBKeyExist(SOFTWAREMicrosoft.NETFrameworkpolicyv4.0)0)then if(AskYesNo(尚未安装.net framework4.0!n与否安装?,YES)then if(LaunchAppAndWait(SUPPORTDIRdotNetFx40_Full

2、_x86_x64_en.exe, /norestart,WAIT)0)then SprintfBox(MB_OK,.NET安装,安装.net框架发生意外!); else InstallNet=TRUE; endif; else InstallNet=FALSE; endif; elseendif;注:InstallNet在开始定义BOOL类型修改OnFirstUIAfter中脚本以判断与否重启。vbs控制IIS直接使用 adsutil.vbs IIS自带脚本来做.基本上IIS所有操作都可以用这个脚本完毕.目录在C:inetpubAdminScriptsServerManagerCmd.exe

3、管理安装服务器角色参数名称:修改IIS中ISAPI和CGI限制%windir%system32inetsrvappcmd.exe set config /section:isapiCgiRestriction /path=C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_isapi.dll.allowed:True控制文本框自定义界面,如果控制文本框此时,当选取文本框时,便可取消其他选项状态。多语言安装不同语言安装文献放到不同Components里,然后设立相应安装语言条件即可获取安装环境语言获取Version信息读取ProductVersion

4、PropertyInstallshield获取安装包版本系统变量为IFX_PRODUCT_VERSION打开对话框时候按某个途径打开打开某一种途径文献夹用这个函数 ShowProgramFolder ( szFolder,nCommand );判断服务状态ServiceGetServiceStateInstallshield环境变量追加与删除= 环境变量追加与删除 = 环境变量添加或追加 =* 问题:如何能在安装包中添加环境变量,而不用顾客手动在我电脑/属性/高档/环境变量中设立,特别是,如何能判断已有环境变量,如Path,在不变化已有环境变量内容基本上,进行追加呢?* 解决方案:添加环境变量

5、时,可以通过注册表中相应位置写键值方式完毕:HKEY_LOCAL_MACHINESYSTEMControlSet001ControlSession ManagerEnvironment.一方面判断Path与否存在,如果不存在,创立,如果存在,已有内容进行追加。追加办法参照如下代码:function AddPath() NUMBER nResult,nType,nSize,nvSize,nvType;STRING strResult,szkey,szNumName,szNumValue,nRootKey,szPath,szPath2;STRING TITLE,szFormat;begin Reg

6、DBSetDefaultRoot(HKEY_LOCAL_MACHINE);szkey=SYSTEMControlSet001ControlSession ManagerEnvironment;/ has no the key,then create the key if (RegDBKeyExist(szkey) 0)then if (RegDBCreateKeyEx(szkey,) 0) thenMessageBox (RegDBCreateKeyEx failed.,SEVERE);return FALSE;endif;endif;/添加系统途径 RegDBGetKeyValueEx(sz

7、key,Path,nvType,szPath,nvSize);if szPath!= then PathSet(szPath);if (PathAdd(TARGETDIRscratchbin,FULL,AFTER) 0) thenMessageBox (Unable to add to path buffer.,SEVERE);abort;endif;PathGet(szPath);Disable(LOGGING);if (RegDBSetKeyValueEx(szkey,Path,REGDB_STRING,szPath,-1) 0) thenMessageBox (RegDBSetKeyVa

8、lueEx failed.,SEVERE);return FALSE;endif;Enable(LOGGING);elseszPath=TARGETDIRscratchbin;/ Set a key name and a value associated with it.Disable(LOGGING);if (RegDBSetKeyValueEx(szkey,Path,REGDB_STRING,szPath,-1) =0 thenStrSub(szmsg1,szfilename,0,nresult + 4);StrSub(szmsg2,szfilename,nresult + 4,200);

9、LongPathToQuote(szmsg1,FALSE );LongPathToQuote(szmsg2,FALSE );/szfilename = + szmsg1 + +szmsg2;endif;if(LaunchAppAndWait(szmsg1,szmsg2,LAAW_OPTION_WAIT_INCL_CHILD | LAAW_OPTION_WAIT) 0 )thenMessageBox(旧版本卸载失败,MB_OK);abort;elseWaitForApplication(LAAW_PROCESS_INFORMATION.hProcess,LAAW_PROCESS_INFORMAT

10、ION.dwProcessId,INFINITE,LAAW_OPTION_WAIT_INCL_CHILD | LAAW_OPTION_WAIT);endif;szIcon = DesktopFolder;DeleteFolderIcon(szIcon,AliProbe);szDir = INSTALLDIR + AliProbe V1.1;DeleteDir(szDir,ALLCONTENTS);end;需要注意地方是,在调用LaunchAppAndWait办法等待老版本卸载完毕时候,一定要加上LAAW_OPTION_WAIT_INCL_CHILD ,重要是由于卸载过程是Windows Ins

11、tall启动卸载程序,因此一定要等待Windows Install子进程结束,否则将不能等待。4.在OnResumeUIAfter中完毕新版本安装,脚本如下:/-/ OnResumeUIAfter/ The OnResumeUIBefore event is called when end user runs installation that is/ performing a resumed install. Usually this happens by specifying a property/ like REINSTALL or ADDLOCAL at the command lin

12、e when the product is already/ installed. In the handler,installation usually displays UI that will/ inform end user that Reinstallation has been completed successfully./-function OnResumeUIAfter()STRING noUse;NUMBER szProcessId;NUMBER nvProcessHandle;/ Handle to a processNUMBER nvModuleHandle;/ Han

13、dle to a process moduleSTRING szModuleName;/ Module filenameNUMBER nvBytesRequired;beginszProcessId = GetCurrentProcessId();if szProcessId != 0 thenif ProcessRunning(noUse,szProcessId,szModuleName) = TRUE thenLaunchApp(szModuleName,/hide_progress);elseMessageBox(自动安装新版本遇到问题,请再次运营安装文献完毕安装。,MB_OK);end

14、if;elseMessageBox(自动安装新版本遇到问题,请再次运营安装文献完毕安装。,MB_OK);endif;end;这里是通过GetCurrentProcessId得到当迈进程Id,并调用ProcessRunning获取当迈进程模块完整途径。5.ProcessRunning脚本如下:/ Function:_Process_Running/ Description:Determines if the specified process is running in memory./ Parameters:szAppName - Name of the application to chec

15、k./ nvFindProcessId - ID of the process to find./ szFindModName - Name of the Module of the found process/ Returns:TRUE - The process is running./ FALSE - The process is not running./function BOOL ProcessRunning(szAppName,nvFindProcessId,szFindModName)BOOL bvRunning;/ Process is runningNUMBER nvProc

16、essIDs(512);/ Array of process IDsNUMBER nvBytesReturned;/ Number of bytes returned in process ID arrayNUMBER nvProcesses;/ Number of processes runningNUMBER nvIndex;/ Loop indexNUMBER nvProcessHandle;/ Handle to a processNUMBER nvModuleHandle;/ Handle to a process moduleNUMBER nvBytesRequired;/ Num

17、ber of bytes required to store valuesPOINTER pvProcessIDs;/ Pointer to process ID arraySTRING svModuleName;/ Module nameSTRING svFileName;/ Module filenamebegin/ The psapi.dll reads the Windows NT performance database. The DLL/ is part of the Win32 SDK.if UseDLL(WINSYSDIR PSAPI_FILE) 0 then/ Could n

18、ot load psapi.dll.MessageBox(ERROR:Could not load + WINSYSDIR PSAPI_FILE +.,SEVERE);return FALSE;endif;/ Get the PIDs of all currently running processes.pvProcessIDs = ArrayToPointer(nvProcessIDs);EnumProcesses(pvProcessIDs,512,nvBytesReturned);/ Determine the number of process IDs retrieved. Each p

19、rocess ID/ is PROCESSID_LENGTH bytes.nvProcesses = nvBytesReturned / PROCESSID_LENGTH;/ Get the executable associated with each process,and check if/ its filename matches the one passed to the function.for nvIndex = 1 to nvProcesses/ Get a handle to the process.nvProcessHandle = OpenProcess(PROCESS_

20、QUERY_INFORMATION |PROCESS_VM_READ,0,nvProcessIDs(nvIndex);if nvProcessHandle != 0 then/ Get a handle to the first module in the process,which/ should be the executable.if EnumProcessModules(nvProcessHandle,nvModuleHandle,PROCESSID_LENGTH,nvBytesRequired) != 0 then/ Get the path of the module.if Get

21、ModuleFileNameExA(nvProcessHandle,nvModuleHandle,svModuleName,SizeOf(svModuleName) != 0 then/ Extract the filename (without an extension) from/ the path. /Add by QianShi at .6.23/Get module name by process id.if nvProcessIDs(nvIndex) = nvFindProcessId thenszFindModName = svModuleName;bvRunning = TRU

22、E;goto ProcessRunningEnd;endif;ParsePath(svFileName,svModuleName,FILENAME_ONLY);if StrCompare(svFileName,szAppName) = 0 then/ The process module matches the application/ name passed to the function.bvRunning = TRUE;goto ProcessRunningEnd;endif;endif;endif;endif;endfor;ProcessRunningEnd:if UnUseDLL(P

23、SAPI_FILE) 0 thenMessageBox(ERROR:Could not unload + WINSYSDIR PSAPI_FILE +.,SEVERE);return FALSE;endif;return bvRunning;end;程序功能重要是枚举当迈进程Id,并通过Id匹配来得到Id相应Module name,本函数同样可以判断某个name进程与否正在运营。以上就是本人对用IS脚本完毕安装新版本前卸载老版本办法, 如果人们有其她好办法,请多多指教。 原文链接自带更新升级问题汇总1.当安装程序需要删除某些文献时候,需要做Major Upgrade,新安装之前必要卸载旧版本2.Dll文献升级必要更改版本号注册表相应反映HKLMSOFTWAREClassesInstallerProducts5BDC99C4525D2BF4B80FC1C7CD0A77FB(1. 掌管安装语言类型,2新版本安装也会检测此值)HKLMSOFTWAREMicrosoftWindowsCurrentVersionUninstallInstallShield_4C99CDB5-D525-4FB2-8BF0-1C7CDCA077BF判断与否安装;1.HKLMSOFTWAREClassesInstallerProducts5BD

展开阅读全文
部分上传会员的收益排行 01、路***(¥15400+),02、曲****(¥15300+),
03、wei****016(¥13200+),04、大***流(¥12600+),
05、Fis****915(¥4200+),06、h****i(¥4100+),
07、Q**(¥3400+),08、自******点(¥2400+),
09、h*****x(¥1400+),10、c****e(¥1100+),
11、be*****ha(¥800+),12、13********8(¥800+)。
相似文档                                   自信AI助手自信AI助手
搜索标签

当前位置:首页 > 教育专区 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服