最新消息:

ExDlg为NSIS提供用res资源文件来创建自定义界面

nsis 永恒心锁 2358浏览 0评论
/*
ExDlg为NSIS提供用res资源文件来创建自定义界面
这个插件使用.res资源文件代替.ini文件来创建自定义界面,这个插件必须在Section里执行
这样对于常用VS工具的人来说显得挺方便的,但要注意的是.res是.rc文件编译后的二进制文件
*/
!AddPluginDir "../../Plugins"
; Installer Attributes
;-----------------------------------------------------
Name "ExDlg"
OutFile "ExDlg.exe"
ComponentText "Please choose which dialogs with determined control classes to see in action using ExDlg..."
 "" "Choose which test dialogs to run:"
InstallButtonText "Run"
; Hidden "-pre" Section.
;-----------------------------------------------------
Section "-pre"
 SetOutPath $TEMP
 File ".Example.res"
SectionEnd
; Sample Dialog Page #1
;-----------------------------------------------------
Section '"EDIT" and "BUTTON"'
 exdlg::create_dlg "101" "$TEMPExample.res"
 Pop $0
 Push $0
 push "1005"
 call DisplayResult
 Push $0
 push "1007"
 call DisplayResult
 Push $0
 push "1008"
 call DisplayResult
 Push $0
 push "112"
 call IsChecked
 Push $0
 push "113"
 call IsChecked
 exdlg::dealloc $0
SectionEnd
; Sample Dialog Page #2
;-----------------------------------------------------
Section '"START_BROWSE" and TRACKBAR_CLASS'
 exdlg::create_dlg "102" "$TEMPExample.res"
 Pop $0
 Push $0
 push "104"
 call DisplayResult
 Push $0
 push "105"
 call SliderPercent
 exdlg::dealloc $0
SectionEnd
; Sample Dialog Page #3
;-----------------------------------------------------
Section '"FILE_BROWSE" and "DIR_BROWSE"'
 exdlg::create_dlg "103" "$TEMPExample.res"
 Pop $0
 Push $0
 push "15"
 call DisplayResult
 Push $0
 push "16"
 call DisplayResult
 exdlg::dealloc $0
SectionEnd
; Hidden "-post" Section.
;-----------------------------------------------------
Section "-post"
 Delete "$TEMPscript1.res"
SectionEnd
; IsChecked Function: Detects if a checkbox is checked
;-----------------------------------------------------
Function IsChecked
 exdlg::push_windowtext
 Pop $1
 StrCmp "! invalid id" $1 nothing
 StrCmp "checked" $1 not_checked
 goto nothing
 not_checked:
 MessageBox MB_OK $1
 nothing:
FunctionEnd
; DisplayResult Function: Detects the control's state
;-----------------------------------------------------
Function DisplayResult
 exdlg::push_windowtext
 Pop $1
 StrCmp "! invalid id" $1 nothing
 StrCmp "" $1 nothing
 MessageBox MB_OK $1
 nothing:
FunctionEnd
; SliderPercent Function: Detects the item selected
;-----------------------------------------------------
Function SliderPercent
 exdlg::push_windowtext
 Pop $1
 StrCmp "! invalid id" $1 nothing
 StrCmp "" $1 nothing
 IntOp $1 100 - $1
 MessageBox MB_OK "You thought it was $1% cool"
 nothing:
FunctionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » ExDlg为NSIS提供用res资源文件来创建自定义界面

您必须 登录 才能发表评论!