最新消息:

按下自定义页面上的不同按钮显示不同的自定义页面

nsis 永恒心锁 2224浏览 0评论
!define PRODUCT_NAME "ESET NOD32 Antivirus"
SetCompressor /SOLID lzma
SetCompressorDictSize 32
!include "MUI.nsh"
!include "UsefulLib.nsh"
!define MUI_ABORTWARNING
!define MUI_ICON "EAV.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "header.bmp"
!define MUI_HEADERIMAGE_RIGHT
page custom io1 leave
page custom io2
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
ReserveFile "io1.ini"
ReserveFile "header.bmp"
ReserveFile "io2.ini"
ReserveFile "repair.ico"
ReserveFile "remove.ico"
Name "${PRODUCT_NAME}"
OutFile "EAVSet.exe"
InstallDir "$EXEDIR"
SetFont "Tahoma" 8
BrandingText "$r"
Var Check
Section
StrCmp $Check "fix" 0 +2
Call inst
StrCmp $Check "del" 0 +2
Call uninst
SectionEnd
Function .onInit
;IfFileExists "$EXEDIRegui.exe" +3
; MessageBox MB_OK|MB_ICONEXCLAMATION "请把本程序放在 ${PRODUCT_NAME} 安装目录下运行!"
; Quit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "io1.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "io2.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "repair.ico"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "remove.ico"
!insertmacro MUI_INSTALLOPTIONS_WRITE "io1.ini" "Field 1" "Text" "$PLUGINSDIRrepair.ico"
!insertmacro MUI_INSTALLOPTIONS_WRITE "io1.ini" "Field 3" "Text" "$PLUGINSDIRremove.ico"
FunctionEnd
Function io1
Push $R1
Push $R2
GetDlgItem $R1 $HWNDPARENT 1
EnableWindow $R1 0
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "io1.ini"
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "io1.ini" "Field 2" "HWND"
SendMessage $R1 ${WM_SETFOCUS} 0 0 ;设置焦点
SendMessage $R1 ${BN_SETFOCUS} 1 0 ;通知已设置焦点
SendMessage $R1 ${BM_SETSTYLE} 0x00000001 0x1
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "io1.ini" "Field 5" "HWND"
CreateFont $R2 "$(^Font)" "$(^FontSize)" "700"
SendMessage $R1 ${WM_SETFONT} $R2 0
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "io1.ini" "Field 7" "HWND"
SendMessage $R1 ${WM_SETFONT} $R2 0
!insertmacro MUI_HEADER_TEXT "修改、修复或删除安装" "选择您想执行的操作。"
!insertmacro MUI_INSTALLOPTIONS_SHOW
Pop $R2
Pop $R1
FunctionEnd
Function leave
!insertmacro MUI_INSTALLOPTIONS_READ $0 "io1.ini" "Settings" "State"
${Switch} $0
${Default}
Abort
${Case} 2
StrCpy $Check "fix"
!insertmacro MUI_INSTALLOPTIONS_WRITE "io2.ini" "Field 1" "Text" "单击“修复”来修复 ESET NOD32 Antivirus的安装。如果您想复查或更改您的安装设置,请单击“上一步”。单击“取消”可退出向导。"
${Break}
${Case} 4
StrCpy $Check "del"
!insertmacro MUI_INSTALLOPTIONS_WRITE "io2.ini" "Field 1" "Text" "单击“删除”来从您的计算机删除 ESET NOD32 Antivirus。如果您想复查或更改您的安装设置,请单击“上一步”。单击“取消”可退出向导。"
${EndSwitch}
FunctionEnd
!macro MY_INSTALLOPTIONS str ht1 ht2
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "io2.ini"
GetDlgItem $R1 $HWNDPARENT 1
SendMessage $R1 ${WM_SETTEXT} 0 "STR:${str}"
!insertmacro MUI_HEADER_TEXT "${ht1}" "${ht2}"
!insertmacro MUI_INSTALLOPTIONS_SHOW
!macroend
Function io2
GetDlgItem $R1 $HWNDPARENT 1
ShowWindow $R1 ${SW_SHOW}
StrCmp $Check "fix" 0 +2
!insertmacro MY_INSTALLOPTIONS "修复(&R)" "修复 ESET NOD32 Antivirus" "安装向导准备开始修复 ESET NOD32 Antivirus。"
StrCmp $Check "del" 0 +2
!insertmacro MY_INSTALLOPTIONS "删除(&R)" "删除 ESET NOD32 Antivirus" "您已选择从您的计算机删除程序。"
FunctionEnd
Function inst
;在这里放上绿化的代码
;....................
HideWindow
MessageBox MB_OK|MB_ICONINFORMATION "${PRODUCT_NAME} 已修复成功!"
Quit
FunctionEnd
Function uninst
;在这里放上卸载的代码
;....................
HideWindow
MessageBox MB_YESNO|MB_TOPMOST|MB_ICONQUESTION "必须重启计算机才能完成卸载,是否立即重启计算机?" IDNO +2
Reboot
Quit
FunctionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 按下自定义页面上的不同按钮显示不同的自定义页面

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址