!Include "UseFulLib.nsh"
${define} HWND_TOP 0
${define} SWP_SHOWWINDOW 0x0040
${define} SC_CLOSE0xF060
${define} trydef `!insertmacro IF_NDEF_DEF`
!macro IF_NDEF_DEF SYMBOL CONTENT
!ifndef `${SYMBOL}`
!define `${SYMBOL}` `${CONTENT}`
!endif
!macroend
${define} defStyle `!insertmacro defStyle`
!macro defStyle dwExStyle dwStyle
${define} CTL_EXSTYLE${dwExStyle}
${define} CTL_STYLE${dwStyle}
!macroend
${define} CreateWindowEx `User32::CreateWindowEx(i,t,t,i,i,i,i,i,i,i,i,v) i`
;先根据需要添加或修改一些函数吧
###############################################################
# 函数: EnableSysMenuItem
###############################################################
!insertmacro DEFINE_FUNC_LITE EnableSysMenuItem
!macro INSERT_FUNC_LITE_EnableSysMenuItem item state
System::Call 'User32::GetSystemMenu(i, i) i ($HWNDPARENT, 0) .s'
Exch $R0
System::Call "User32::EnableMenuItem(i, i, i) i (R0, ${item}, ${state})"
Pop $R0
!macroend
###############################################################
# 函数: AddLabel
###############################################################
!insertmacro DEFINE_FUNC_LITE AddLabel
!macro INSERT_FUNC_LITE_AddLabel TITLE LEFT TOP WIDTH HEIGHT HWNDDLG CTLID TEXTCOLOR BGCOLOR
System::Call /NOUNLOAD 'Kernel32::GetModuleHandle(t) i (0) .s'
Push `${TITLE}`
!ifndef CTL_STYLE ;Style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
System::Call '${CreateWindowEx}(0,"STATIC",s,0x54000000,${LEFT},${TOP},${WIDTH},${HEIGHT},${HWNDDLG},${CTLID},s,0) .s'
!else
${trydef} CTL_EXSTYLE 0
System::Call '${CreateWindowEx}(${CTL_EXSTYLE},"STATIC",s,${CTL_STYLE},${LEFT},${TOP},${WIDTH},${HEIGHT},${HWNDDLG},${CTLID},s,0) .s'
!undef CTL_STYLE
!endif
Exch $R0
Push $R1
CreateFont $R1 $(^Font) $(^FontSize) ${FW_NORMAL}
SendMessage $R0 ${WM_SETFONT} $R1 0
SetCtlColors $R0 ${TEXTCOLOR} ${BGCOLOR}
Pop $R1
Pop $R0
!macroend
###############################################################
# 函数: AddCheckbox
###############################################################
!insertmacro DEFINE_FUNC_LITE AddCheckbox
!macro INSERT_FUNC_LITE_AddCheckbox TITLE LEFT TOP WIDTH HEIGHT HWNDDLG CTLID STATE
System::Call /NOUNLOAD 'Kernel32::GetModuleHandle(t) i (0) .s'
Push `${TITLE}`
;Style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_TABSTOP | BS_TEXT | BS_VCENTER | BS_AUTOCHECKBOX | BS_MULTILINE
System::Call '${CreateWindowEx}(0,"BUTTON",s,0x54012C03,${LEFT},${TOP},${WIDTH},${HEIGHT},${HWNDDLG},${CTLID},s,0) .s'
Exch $R0
Push $R1
CreateFont $R1 $(^Font) $(^FontSize) ${FW_NORMAL}
SendMessage $R0 ${WM_SETFONT} $R1 0
SendMessage $R0 ${BM_SETCHECK} ${STATE} 0
!ifdef PAGE_BGCOLOR
SetCtlColors $R0 "" ${PAGE_BGCOLOR}
!endif
!ifdef CHECK_FUNCTION
GetFunctionAddress $R1 ${CHECK_FUNCTION}
ButtonEvent::AddEventHandler /NOUNLOAD ${CTLID} $R1
!undef CHECK_FUNCTION
!endif
Pop $R1
Pop $R0
!macroend
###############################################################
# 函数: GetCheckState
###############################################################
!insertmacro DEFINE_FUNC_LITE GetCheckState
!macro INSERT_FUNC_LITE_GetCheckState OUT HWNDDLG CTLID
Push $R0
GetDlgItem $R0 ${HWNDDLG} ${CTLID}
SendMessage $R0 ${BM_GETCHECK} 0 0 ${OUT}
Pop $R0
!macroend
###############################################################
# 函数: SetCheckState
###############################################################
!insertmacro DEFINE_FUNC_LITE SetCheckState
!macro INSERT_FUNC_LITE_SetCheckState HWNDDLG CTLID State
Push $R0
GetDlgItem $R0 ${HWNDDLG} ${CTLID}
SendMessage $R0 ${BM_SETCHECK} ${State} 0
Pop $R0
!macroend
;nsi中不想看到的东西都可以放到下面(反正我也不是要写个通用的头文件)
ChangeUI all ".Resourcemyui.exe"
AutoCloseWindow true
InstallColors /windows
InstProgressFlags smooth
XPStyle On
SubCaption 0 " "
SubCaption 1 " "
SubCaption 2 " "
SubCaption 3 " "
SubCaption 4 " "
!macro SHOW_PARENT_CTL CTLID STATE
Push $R0
GetDlgItem $R0 $HWNDPARENT ${CTLID}
EnableWindow $R0 ${STATE}
ShowWindow $R0 ${STATE}
Pop $R0
!macroend
;!macro SHOW_PAGE_CTL CTLID STATE
;Push $R0
;FindWindow $R0"#32770" "" $HWNDPARENT
;GetDlgItem $R0 $R0 ${CTLID}
;EnableWindow $R0 ${STATE}
;ShowWindow $R0 ${STATE}
;Pop $R0
;!macroend
!macro SetButton CTLID ADDFUNC
!insertmacro SHOW_PARENT_CTL ${CTLID} 1
Push $R0
GetFunctionAddress $R0 ${ADDFUNC}
ButtonEvent::AddEventHandler /NOUNLOAD ${CTLID} $R0
Pop $R0
!macroend
!macro UnsetButton CTLID
ButtonEvent::UnsetEventHandler /NOUNLOAD ${CTLID}
!insertmacro SHOW_PARENT_CTL ${CTLID} 0
;${DestroyWindow} $HWNDPARENT ${CTLID}
!macroend
!macro SET_HEADER_IMAGE temp_bmp source_bmp
;StrCmp $PLUGINSDIR "" 0 +2
;InitPluginsDir
IfFileExists "$PLUGINSDIR${temp_bmp}" +2
File "/oname=$PLUGINSDIR${temp_bmp}" "${source_bmp}"
SetBrandingImage /IMGID=1046 "$PLUGINSDIR${temp_bmp}"
!macroend
!macro SET_PAGECTL_TEXT CTLID TEXT
Push $R0
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 ${CTLID}
SendMessage $R0 ${WM_SETTEXT} 0 "STR:${TEXT}"
;ShowWindow $R0 ${SW_SHOW}
Pop $R0
!macroend
!macro SET_PAGECTL_COLOR CTLID TextColor BgColor
Push $R0
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 ${CTLID}
SetCtlColors $R0 ${TextColor} ${BgColor}
Pop $R0
!macroend
!macro SET_PAGECTL_FONT CTLID fname height weight
Push $R0
Push $R1
CreateFont $R1 "${fname}" "${height}" "${weight}"
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 ${CTLID}
SendMessage $R0 ${WM_SETFONT} $R1 0
Pop $R1
Pop $R0
!macroend
!macro PAGEINIT_BASIC
Push $R0
FindWindow $R0 "#32770" "" $HWNDPARENT
SetCtlColors $R0 "" ${PAGE_BGCOLOR}
Pop $R0
!insertmacro SET_PAGECTL_COLOR 1006 ${PAGE_TEXTCOLOR} ${PAGE_BGCOLOR}
!macroend
;其实可以用EnumChildWindows枚举来设置所有子窗口控件的颜色,更方便;但这里逐个控件写也不是多很多代码,就不用了
/*
懒得用LoadImage了 —— 用LoadImage还要定义变量保存位图句柄最后在.onGUIEnd DeleteObject
这里用了个取巧的方法: 修改UI在105对话框加一个隐藏的BMP控件,通过SetBrandingImage载入位图,
用SendMessage获取位图句柄和给另一个控件设置位图
程序在退出时应该会自动删除SetBrandingImage载入的位图占用的内存的了,我们不用管
其实还有一种更简单的方法,就是我在做FlashGet3界面时用的那种,修改UI并在编译时添加位图资源。
*/
!macro SET_INSTPAGE_IMAGE bmpfile
File "/oname=$PLUGINSDIRnewfeather.bmp" "${bmpfile}"
SetBrandingImage /IMGID=16001 "$PLUGINSDIRnewfeather.bmp"
Push $R0
Push $R1
GetDlgItem $R0 $HWNDPARENT 16001
SendMessage $R0 ${STM_GETIMAGE} ${IMAGE_BITMAP} 0 $R0
FindWindow $R1 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R1 1005
SendMessage $R1 ${STM_SETIMAGE} ${IMAGE_BITMAP} $R0
Pop $R1
Pop $R0
!macroend
; PPTV 欢迎页面
!macro MyWelcomePage
PageEx license
LicenseText "${WELCOMEPAGE_TEXT_TOP}" "$(^NextBtn)"
PageCallbacks "" WelcomePageShow
PageExEnd
Function WelcomePageShow
!insertmacro PAGEINIT_BASIC
!insertmacro SET_HEADER_IMAGE "welcom_header.bmp" ".Resourcewelcom_header.bmp"
Push $R0
Push $R1
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1000
System::Call "User32::DestroyWindow(i R1)"
GetDlgItem $R1 $R0 1006
System::Call "User32::SetWindowPos(i, i, i, i, i, i, i) i (R1, ${HWND_TOP}, 23, 10, 428, 110, ${SWP_SHOWWINDOW})"
GetDlgItem $R1 $R0 1040
System::Call "User32::SetWindowPos(i, i, i, i, i, i, i) i (R1, ${HWND_TOP}, 23, 120, 428, 210, ${SWP_SHOWWINDOW})"
SendMessage $R1 ${WM_SETTEXT} 0 "STR:${WELCOMEPAGE_TEXT_BOTTOM}"
SetCtlColors $R1 0x007CB3 ${PAGE_BGCOLOR}
Pop $R1
Pop $R0
FunctionEnd
!macroend
!macro FINISH_OPTION_CHECK CTLID
Push $R0
Push $R1
FindWindow $R0 "#32770" "" $HWNDPARENT
${GetCheckState} $R1 $R0 ${CTLID}
${If} $R1 == 1
!ifdef FINISH_OPTION_FUNC
Call ${FINISH_OPTION_FUNC}
!undef FINISH_OPTION_FUNC
!else
${MessageBox2} "请在插入FINISH_OPTION_CHECK宏前定义选项函数,格式:!define FINISH_OPTION_FUNC XXXXXX" "测试一下:选中的CheckBox ID是${CTLID}" MB_ICONINFORMATION|MB_OK
!endif
${EndIf}
Pop $R1
Pop $R0
!macroend
!macro FINISH_OPTION_CHECK_FIX CTLID FINISH_OPTION
!ifdef ${FINISH_OPTION}
!define FINISH_OPTION_FUNC ${${FINISH_OPTION}}
!endif
!insertmacro FINISH_OPTION_CHECK ${CTLID}
!macroend
; PPTV 完成页面
!macro MyFinishPage
PageEx license
LicenseText "" "完成(&F)"
PageCallbacks FinishPagePre FinishPageShow FinishPageLeave
PageExEnd
Function FinishPagePre
Push $R0
GetDlgItem $R0 $HWNDPARENT 3
EnableWindow $R0 0
Push $R0
FunctionEnd
${define} IDC_RUN110001
${define} IDC_RUN210002
${define} IDC_RUN310003
${define} IDC_RUN410004
${define} IDC_RUN510005
${define} IDC_RUN610006
${define} IDC_LABEL110011
${define} IDC_LABEL210012
${define} IDC_LABEL310013
${define} IDC_LABEL410014
${define} IDC_LABEL510015
${define} IDC_LABEL610016
${define} IDC_CHECKALL10007
Function FinishPageShow
!insertmacro SET_HEADER_IMAGE "finish_header.bmp" ".Resourcefinish_header.bmp"
Push $R0
Push $R1
FindWindow $R0 "#32770" "" $HWNDPARENT
SetCtlColors $R0 "" ${PAGE_BGCOLOR}
GetDlgItem $R1 $R0 1000
System::Call "User32::DestroyWindow(i R1)"
GetDlgItem $R1 $R0 1006
System::Call "User32::DestroyWindow(i R1)"
GetDlgItem $R1 $R0 1040
SendMessage $R1 ${WM_SETTEXT} 0 "STR:${FINISHPAGE_TEXT_TOP}"
SetCtlColors $R1 "" ${PAGE_BGCOLOR}
${AddCheckbox} "立即运行 PPTV网络电视" 0 41 200 23 $R0 ${IDC_RUN1} ${BST_CHECKED}
${AddCheckbox} "启动 Windows 时自动运行 PPTV" 200 41 450 23 $R0 ${IDC_RUN2} ${BST_CHECKED}
;Style = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | SS_ETCHEDHORZ | SS_LEFT | SS_SUNKEN
;ExStyle = WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_STATICEDGE
${defStyle} 0x00020 0x54001010
${AddLabel} "" 0 68 448 2 $R0 0 0 transparent ;ExStyle = ${CTL_EXSTYLE} | WS_EX_TRANSPARENT
;貌似在安装过程中会下载一些文件,如果不能上网,下面这些控件不会创建
${AddLabel} "PPTV推荐安装:" 0 75 135 23 $R0 ${IDC_LABEL1} 0 transparent
${AddLabel} "请您选择希望安装的附加组件" 143 77 450 15 $R0 ${IDC_LABEL2} 0 transparent
${AddCheckbox} "搜狗浏览器" 0 105 158 15 $R0 ${IDC_RUN3} ${BST_CHECKED}
${AddCheckbox} "PP250网址导航" 0 128 158 15 $R0 ${IDC_RUN4} ${BST_CHECKED}
${AddCheckbox} "瑞星" 0 150 158 15 $R0 ${IDC_RUN5} ${BST_CHECKED}
${AddCheckbox} "360杀毒" 0 173 158 15 $R0 ${IDC_RUN6} ${BST_CHECKED}
${AddLabel} "高速上网必备,首选搜狗高速浏览器" 158 107 315 15 $R0 ${IDC_LABEL3} 0x555555 transparent
${AddLabel} "设$"PP250网址导航$"为IE首页" 158 129 315 15 $R0 ${IDC_LABEL4} 0x555555 transparent
${AddLabel} "2010新版、免序列号、即装即用" 158 152 315 15 $R0 ${IDC_LABEL5} 0x555555 transparent
${AddLabel} "轻巧快速免打扰,强力杀毒不卡机" 158 174 315 15 $R0 ${IDC_LABEL6} 0x555555 transparent
!define CHECK_FUNCTION "CheckAll"
${AddCheckbox} "全选" 375 195 55 15 $R0 ${IDC_CHECKALL} ${BST_CHECKED}
Pop $R1
Pop $R0
!insertmacro SET_PAGECTL_FONT ${IDC_LABEL1} $(^Font) 11 "700"
FunctionEnd
Function FinishPageLeave
!insertmacro FINISH_OPTION_CHECK_FIX ${IDC_RUN1} FINISH_OPTION1
!insertmacro FINISH_OPTION_CHECK_FIX ${IDC_RUN2} FINISH_OPTION2
!insertmacro FINISH_OPTION_CHECK_FIX ${IDC_RUN3} FINISH_OPTION3
!insertmacro FINISH_OPTION_CHECK_FIX ${IDC_RUN4} FINISH_OPTION4
!insertmacro FINISH_OPTION_CHECK_FIX ${IDC_RUN5} FINISH_OPTION5
!insertmacro FINISH_OPTION_CHECK_FIX ${IDC_RUN6} FINISH_OPTION6
FunctionEnd
Function CheckAll
Push $R0
Push $R1
FindWindow $R0 "#32770" "" $HWNDPARENT
${GetCheckState} $R1 $R0 ${IDC_CHECKALL}
${SetCheckState} $R0 ${IDC_RUN3} $R1
${SetCheckState} $R0 ${IDC_RUN4} $R1
${SetCheckState} $R0 ${IDC_RUN5} $R1
${SetCheckState} $R0 ${IDC_RUN6} $R1
Pop $R1
Pop $R0
FunctionEnd
!macroend
SetCompressor lzma
SetCompressorDictSize 32
!AddIncludeDir "."
;!define Project PPTV
;!include "Assoc.nsh" ;Ansifa的文件关联头文件
!include "MyUI.nsh"
!define PRODUCT_NAME "PPTV网络电视"
!define PRODUCT_VERSION "V2.4.3.0012"
!define PAGE_BGCOLOR 0xFFFFFF
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
Caption "$(^Name) 安装 - by gfm688"
OutFile "PPTV_Test.exe"
Icon ".ResourceIcon.ico"
LoadLanguageFile "${NSISDIR}ContribLanguage filesSimpChinese.nlf"
ReserveFile "${NSISDIR}PluginsButtonEvent.dll"
BrandingText "WWW.PPTV.COM"
CheckBitmap ".Resourcecheck.bmp"
ComponentText "${PRODUCT_NAME}将与您的本地媒体文件建立关联,以便您用PPTV客户端打开本地文件" "勾选需要关联的文件格式:"
ShowInstDetails nevershow
InstallDir "$PROGRAMFILESPPTV"
DirText "“安装向导”将安装 $(^Name) 在下列文件夹。$n$n要安装到不同文件夹,单击 [浏览(B)] 并选择其他的文件夹。$n$n单击 [下一步(N)] 继续。"
LicenseBkColor ${PAGE_BGCOLOR}
!define WELCOMEPAGE_TEXT_TOP "${PRODUCT_NAME}是PPLive旗下全球最大的网络电视平台。$n$n
本向导将引导你完成${PRODUCT_NAME}客户端的安装。$n
安装进程开始前,建议先关闭其他所有应用程序。这将允许“安装向导”更新相应的系统文件,而无需重新启动你的计算机。$n$n
单击 [下一步(N)] 继续。"
!define WELCOMEPAGE_TEXT_BOTTOM "新版本特性:$n
1.会员用户免广告、看专享频道,充值即享VIP尊贵体验$n
2.关联本地文件,支持播放电脑中的视频文件$n
3.广告策略调整,避免重复弹出,音量可以控制$n
4.新增PPTV$"一起看新鲜$"屏保"
!insertmacro MyWelcomePage
PageEx license
LicenseData ".ResourceLicense.rtf"
LicenseText "如果你接受协议中的条款,单击 [我接受(I)] 继续安装。如果你选定 [取消(C)] ,安装程序将会关闭。必须接受协议才能安装“$(^Name)”。"
PageCallbacks "" LicenseShow
PageExEnd
Page directory "" DirShow
Page instfiles "" InstShow
Page components AssocPre AssocShow AssocLeave
!define FINISHPAGE_TEXT_TOP "${PRODUCT_NAME} 已成功安装到你的计算机。"
;....这里定义6个函数,是在完成页面的离开函数判断CheckBox是否选中而执行的
!define FINISH_OPTION1 RunPPTVNow ;我只写了第1个测试一下,其它5个省略不写了
;!define FINISH_OPTION2 XXXXXX
;.............................
!insertmacro MyFinishPage
Section
;ReserveFile /r /x ".Resourcecheck.bmp" ".Resource*.bmp"
DetailPrint "正在安装 ${PRODUCT_NAME} ..."
Sleep 10
Sleep 100
Sleep 1000
SectionEnd
InstType "全选"
InstType "全不选"
InstType "恢复默认"
!macro InsertSection SEC
Section "${SEC}" SEC${SEC}
SectionIn 1
SectionEnd
!macroend
!macro DefaultSection SEC
Section "${SEC}" SEC${SEC}
SectionIn 1 3
SectionEnd
!macroend
SectionGroup /e "全部媒体文件格式"
SectionGroup "Windows媒体文件"
!insertmacro DefaultSection ".asf"
!insertmacro DefaultSection ".wmv"
!insertmacro InsertSection ".wma"
SectionGroupEnd
SectionGroup "Real媒体文件"
!insertmacro InsertSection ".rm"
!insertmacro InsertSection ".rmvb"
!insertmacro InsertSection ".ra"
SectionGroupEnd
SectionGroup "MEEG4媒体文件"
!insertmacro DefaultSection ".mp4"
!insertmacro InsertSection ".m4v"
!insertmacro InsertSection ".mpeg4"
SectionGroupEnd
SectionGroupEnd
Function LicenseShow
!insertmacro PAGEINIT_BASIC
!insertmacro SET_PAGECTL_TEXT 1040 "按 [PgDn] 阅读“授权协议”的其余部分。"
!insertmacro SET_PAGECTL_COLOR 1040 ${PAGE_TEXTCOLOR} ${PAGE_BGCOLOR}
!insertmacro SET_HEADER_IMAGE "license_header.bmp" ".Resourcelicense_header.bmp"
!insertmacro SET_PAGECTL_COLOR 1006 0x0d839d ${PAGE_BGCOLOR}
FunctionEnd
Function DirShow
!insertmacro PAGEINIT_BASIC
!insertmacro SET_PAGECTL_COLOR 1020 ${PAGE_TEXTCOLOR} ${PAGE_BGCOLOR}
!insertmacro SET_PAGECTL_COLOR 1023 ${PAGE_TEXTCOLOR} ${PAGE_BGCOLOR}
!insertmacro SET_PAGECTL_COLOR 1024 ${PAGE_TEXTCOLOR} ${PAGE_BGCOLOR}
!insertmacro SET_HEADER_IMAGE "directory_header.bmp" ".Resourcedirectory_header.bmp"
FunctionEnd
Function InstShow
!insertmacro PAGEINIT_BASIC
!insertmacro SET_HEADER_IMAGE "instfiles_header.bmp" ".Resourceinstfiles_header.bmp"
!insertmacro SET_INSTPAGE_IMAGE ".Resourcenewfeather.bmp"
FunctionEnd
Function AssocPre
${EnableSysMenuItem} ${SC_CLOSE} ${MF_DISABLED}
GetDlgItem $0 $HWNDPARENT 2
EnableWindow $0 0
SetCurInstType 2
FunctionEnd
Function AssocShow
!insertmacro PAGEINIT_BASIC
!insertmacro SET_PAGECTL_COLOR 1021 ${PAGE_TEXTCOLOR} ${PAGE_BGCOLOR}
!insertmacro SET_HEADER_IMAGE "FileOption.bmp" ".ResourceFileOption.bmp"
!insertmacro SetButton 16002 SelectALL
!insertmacro SetButton 16003 SelectNone
!insertmacro SetButton 16004 SetDefault
!insertmacro SET_PAGECTL_FONT 1006 "Tahoma" "9" "520" ;设置控件字体
!insertmacro SET_PAGECTL_FONT 1021 "Tahoma" "9" "520"
!insertmacro SET_PAGECTL_FONT 1032 "Tahoma" "9" "520"
FunctionEnd
;!define CBN_SELCHANGE 1
!macro CB_SETCURSEL item_index ;item_index: Specifies the zero-based index of the string to select.
Push $R0
Push $R1
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R1 $R0 1017
SendMessage $R1 ${CB_SETCURSEL} ${item_index} 0
SendMessage $HWNDPARENT ${WM_COMMAND} 66553 $R1
;66553 即低位是1017, 高位是CBN_SELCHANGE
Pop $R1
Pop $R0
!macroend
Function SelectALL
!insertmacro CB_SETCURSEL 0
FunctionEnd
Function SelectNone
!insertmacro CB_SETCURSEL 1
FunctionEnd
Function SetDefault
!insertmacro CB_SETCURSEL 2
FunctionEnd
!macro ExecSection_Assoc SEC_IDX EXT DESC ICO CONTENTTYPE CLSID
Push $R0
SectionGetFlags ${SEC_IDX} $R0
IntOp $R0 $R0 & 1 ;第一位不变,其它位 置0
StrCmp $R0 0 +2
;!insertmacro Assoc_Media ${ext} ${ext} ${desc} "$INSTDIRpptv.exe" ${ico} ${ContentType} ${CLSID}
MessageBox MB_ICONINFORMATION|MB_OK "${ext}" ;MessageBox测试用,实际不要的
Pop $R0
!macroend
Function AssocLeave
!insertmacro ExecSection_Assoc ${SEC.asf} "asf" "ASF 媒体文件" "懒得写了" "video/x-ms-asf" "{cd3afa8f-b84f-48f0-9393-7edc34128127}"
!insertmacro ExecSection_Assoc ${SEC.wmv} "wmv" "懒得写了" "懒得写了" "懒得写了" "懒得写了"
;....这里放更多的ExecSection_Assoc
;System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
!insertmacro UnsetButton 16002
!insertmacro UnsetButton 16003
!insertmacro UnsetButton 16004
FunctionEnd
Function RunPPTVNow
${MessageBox2} "立即运行 PPTV网络电视......" "测试用的MsgBox" MB_ICONINFORMATION|MB_OK
;这里放运行PPTV网络电视的代码
FunctionEnd
Function .onGUIInit
;InitPluginsDir
SetCtlColors $HWNDPARENT "" 0xF3F8FC
GetDlgItem $0 $HWNDPARENT 1044
SetCtlColors $0 "" ${PAGE_BGCOLOR}
!insertmacro SHOW_PARENT_CTL 16002 0
!insertmacro SHOW_PARENT_CTL 16003 0
!insertmacro SHOW_PARENT_CTL 16004 0
GetDlgItem $0 $HWNDPARENT 1028
SetCtlColors $0 "" transparent
BrandingURL::Set /NOUNLOAD "0" "114" "255" "http://www.yhxs3344.net/"
;ButtonLinker::CreateLinker /NOUNLOAD $0 "http://www.yhxs3344.net/" ;晕,Linker创建的链接改不了颜色
FunctionEnd
Function .onGUIEnd
#ButtonEvent::Unload
BrandingURL::Unload
FunctionEnd
Function .onUserAbort
MessageBox MB_YESNO|MB_ICONEXCLAMATION "你确实要退出 “$(^Name)” 安装程序?" IDYES +2
Abort
FunctionEnd
© 版权声明
THE END
暂无评论内容