收藏 分销(赏)

installshield学习笔记专业资料.doc

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

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_Fu

2、ll_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:inetpubAdminScriptsServerManagerCm

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

4、ctVersion 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; STRIN

6、G TITLE, szFormat; begin RegDBSetDefaultRoot(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;end

7、if; /添加系统途径 RegDBGetKeyValueEx(szkey,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,sz

8、Path,-1) 0) thenMessageBox (RegDBSetKeyValueEx 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)

9、;StrSub(szmsg2,szfilename,nresult + 4,200);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_P

10、ROCESS_INFORMATION.hProcess, LAAW_PROCESS_INFORMATION.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方法等待老版本卸载完毕的时候

11、,一定要加上LAAW_OPTION_WAIT_INCL_CHILD ,重要是由于卸载的过程是Windows Install启动卸载程序,所以一定要等待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 specifyin

12、g a property/ like REINSTALL or ADDLOCAL at the command line 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 nvPr

13、ocessHandle; / Handle to a processNUMBER nvModuleHandle; / Handle to a process moduleSTRING szModuleName; / Module filenameNUMBER nvBytesRequired;beginszProcessId = GetCurrentProcessId();if szProcessId != 0 thenif ProcessRunning(noUse, szProcessId, szModuleName) = TRUE thenLaunchApp(szModuleName, /h

14、ide_progress);elseMessageBox(自动安装新版本碰到问题,请再次运营安装文献完毕安装。, MB_OK);endif;elseMessageBox(自动安装新版本碰到问题,请再次运营安装文献完毕安装。, MB_OK);endif;end;这里是通过GetCurrentProcessId得到当前进程的Id,并调用ProcessRunning获取当前进程模块的完整途径。5.ProcessRunning的脚本如下:/ Function: _Process_Running/ Description: Determines if the specified process is r

15、unning in memory./ Parameters: szAppName - Name of the application to check./ 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, nv

16、FindProcessId, szFindModName)BOOL bvRunning; / Process is runningNUMBER nvProcessIDs(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 pr

17、ocessNUMBER nvModuleHandle; / Handle to a process moduleNUMBER nvBytesRequired; / Number 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 dat

18、abase. The DLL/ is part of the Win32 SDK.if UseDLL(WINSYSDIR PSAPI_FILE) 0 then/ Could not 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

19、(pvProcessIDs, 512, nvBytesReturned);/ Determine the number of process IDs retrieved. Each process 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 n

20、vIndex = 1 to nvProcesses/ Get a handle to the process.nvProcessHandle = OpenProcess(PROCESS_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(nvProcessHand

21、le, nvModuleHandle,PROCESSID_LENGTH, nvBytesRequired) != 0 then/ Get the path of the module.if GetModuleFileNameExA(nvProcessHandle, nvModuleHandle,svModuleName, SizeOf(svModuleName) != 0 then/ Extract the filename (without an extension) from/ the path. /Add by QianShi at 2023.6.23/Get module name b

22、y process id.if nvProcessIDs(nvIndex) = nvFindProcessId thenszFindModName = svModuleName;bvRunning = TRUE;goto ProcessRunningEnd;endif;ParsePath(svFileName, svModuleName, FILENAME_ONLY);if StrCompare(svFileName, szAppName) = 0 then/ The process module matches the application/ name passed to the func

23、tion.bvRunning = TRUE;goto ProcessRunningEnd;endif;endif;endif;endif;endfor;ProcessRunningEnd:if UnUseDLL(PSAPI_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文献升级必须更改版本号注册表相应的反映HKLMSOFTWAREClassesInstallerProducts5BDC99C4525D2B

展开阅读全文
部分上传会员的收益排行 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 

客服