最新消息:

NSIS 自定义消息

nsis 永恒心锁 1157浏览 0评论
!include "MUI.nsh"
!include "WinMessages.nsh"
!include "LogicLib.nsh"

name "Sendmessage简单例子"
outfile "test.exe"

page custom show leave

!insertmacro MUI_PAGE_INSTFILES
reservefile "pagecustom.ini"
!insertmacro MUI_LANGUAGE "SimpChinese"

section
sectionend

var HWND

function .oninit
initpluginsdir
setoutpath $pluginsdir
file "pagecustom.ini"
functionend

function show
installoptions::initdialog /nounload $pluginsdir\pagecustom.ini
Pop $HWND
!insertmacro MUI_HEADER_TEXT "附加任务" "执行安装程序的一些附加任务" ;通过宏 MUI_HEADER_TEXT 设置页面页眉的文本
GetDlgItem $R0 $HWNDPARENT 1
EnableWindow $R0 0
installoptions::show
GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0
functionend

function leave
ReadINIStr $0 "$pluginsdir\pagecustom.ini" Settings State
ReadINIStr $3 "$pluginsdir\pagecustom.ini" "Field 3" "HWND"
ReadINIStr $4 "$pluginsdir\pagecustom.ini" "Field 4" "HWND"
ReadINIStr $5 "$pluginsdir\pagecustom.ini" "Field 5" "HWND"
ReadINIStr $9 "$pluginsdir\pagecustom.ini" "Field 9" "state"
ReadINIStr $R9 "$pluginsdir\pagecustom.ini" "Settings" "State" ;$7 控件序号
${Switch} $0
${Default}
Abort
${Case} 2 ;全选(001,002,003)
 SendMessage $3 ${BM_SETCHECK} 1 0
 SendMessage $4 ${BM_SETCHECK} 1 0
 SendMessage $5 ${BM_SETCHECK} 1 0
 Abort
${Case} 6 ;使001不可用
 EnableWindow $3 0
 Abort
${Case} 8 ;全否(001,002,003)
 SendMessage $3 ${BM_SETCHECK} 0 0
 SendMessage $4 ${BM_SETCHECK} 0 0
 SendMessage $5 ${BM_SETCHECK} 0 0
 Abort
${Case} 7 ;使001可用
 EnableWindow $3 1
 Abort
${Case} 9 ;使下一步可用
 ${If} $9 = 1
 GetDlgItem $0 $HWNDPARENT 1
 EnableWindow $0 1
 ${Else}
 GetDlgItem $0 $HWNDPARENT 1
 EnableWindow $0 0
 ${EndIf}
 Abort
${Case} 0
${EndSwitch}
functionend

Section "安装过程"
 ReadINIStr $R2 "$pluginsdir\pagecustom.ini" "Field 11" State
 ${If} $R2 == 1
 MessageBox MB_OK "你勾选了我的桌面"
 ${EndIf}
 ReadINIStr $R2 "$pluginsdir\pagecustom.ini" "Field 12" State
 ${If} $R2 == 1
 MessageBox MB_OK "你勾选了开始菜单"
 ${EndIf}
 ReadINIStr $R2 "$pluginsdir\pagecustom.ini" "Field 13" State
 ${If} $R2 == 1
 MessageBox MB_OK "你勾选了快速启动"
 ${EndIf}
 ReadINIStr $R2 "$pluginsdir\pagecustom.ini" "Field 15" State
 ${If} $R2 == 1
 MessageBox MB_OK "你勾选了创建卸载程序"
 ${EndIf}
SectionEnd

;INI 配置文件
[Settings]
NumFields=15

[Field 1]
Type=Groupbox
Text=消息学习Sendmessage
Left=10
Right=208
Top=4
Bottom=94

[Field 2]
Type=RadioButton
Flags=NOTIFY
Text=全选(001,002,003)
State=0
Left=26
Right=110
Top=22
Bottom=33

[Field 3]
Type=Checkbox
Flags=NOTIFY
Text=001
State=0
Left=26
Right=66
Top=43
Bottom=54

[Field 4]
Type=Checkbox
Text=002
Left=78
Right=122
Top=43
Bottom=52
Flags=NOTIFY
State=0

[Field 5]
Type=Checkbox
Text=003
Left=138
Right=186
Top=44
Bottom=52
Flags=NOTIFY
State=0

[Field 6]
Type=Button
Text=使001不可用
Flags=NOTIFY
Left=24
Right=108
Top=65
Bottom=81

[Field 7]
Type=Button
Text=使001可用
Flags=NOTIFY
Left=116
Right=200
Top=65
Bottom=81

[Field 8]
Type=RadioButton
Text=全否(001,002,003)
Flags=NOTIFY
State=0
Left=120
Right=206
Top=22
Bottom=33

[Field 9]
Type=Checkbox
Text=同意安装
Flags=NOTIFY
Left=221
Right=283
Top=81
Bottom=91

[Field 10]
Type=Groupbox
Text=创建快捷方式
Left=217
Right=290
Top=7
Bottom=72

[Field 11]
Type=Checkbox
Text=我的桌面
State=1
Left=221
Right=286
Top=20
Bottom=31

[Field 12]
Type=Checkbox
Text=开始菜单
State=1
Left=221
Right=286
Top=36
Bottom=47

[Field 13]
Type=Checkbox
Text=快速启动
State=1
Left=221
Right=286
Top=52
Bottom=63

[Field 14]
Type=Groupbox
Text=卸载程序
Left=10
Right=292
Top=109
Bottom=139

[Field 15]
Type=Checkbox
Text=在Windows控制面板的"添加或删除程序"里创建本软件的卸载程序
State=1
Left=13
Right=280
Top=121
Bottom=132
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » NSIS 自定义消息

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