最新消息:

预览图片切换功能

nsis 永恒心锁 1479浏览 0评论
Name "test"
OutFile "test.exe"
!include MUI.nsh
Var hwnd
Var ImageHandle
!macro DisplayImage PARENTWIN IMGHANDLE IMG_NAME
 StrCmp $ImageHandle '' +4
 StrCpy $6 $ImageHandle
 System::Call "gdi32::DeleteObject(i) i (r6)"
 StrCpy $6 ''
 GetDlgItem $0 ${PARENTWIN} ${IMGHANDLE}
 System::Call 'user32::LoadImageA(i, t, i, i, i, i) i (0, s, 0, 0, 0, 0x2000|0x0010) .r6' "${IMG_NAME}"
 SendMessage $0 370 0 $6
 StrCpy $ImageHandle $6
!macroend
ReserveFile "${NSISDIR}PluginsInstallOptions.dll"
ReserveFile io.ini
;ReserveFile img1.bmp
;ReserveFile img2.bmp
Page custom SetCustom LeaveCustom
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE SimpChinese
Section -nothing
SectionEnd
Function .onInit
 InitPluginsDir
 File /oname=$PLUGINSDIRio.ini io.ini
 File /oname=$PLUGINSDIRimg1.bmp img1.bmp
 File /oname=$PLUGINSDIRimg2.bmp img2.bmp
 WriteINIStr "$PLUGINSDIRio.ini" "Field 1" "Text" "$PLUGINSDIRimg1.bmp"
FunctionEnd
Function SetCustom
 InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIRio.ini"
 Pop $hwnd
 !insertmacro DisplayImage $hwnd 1200 "$PLUGINSDIRimg1.bmp"
 InstallOptions::show
FunctionEnd
Function LeaveCustom
 ReadINIStr $0 "$PLUGINSDIRio.ini" "Settings" "State"
 StrCmp $0 3 ImgBtn1
 StrCmp $0 4 ImgBtn2
 Goto InstallBtn
 ImgBtn1:
 !insertmacro DisplayImage $hwnd 1200 "$PLUGINSDIRimg1.bmp"
 Abort
 ImgBtn2:
 !insertmacro DisplayImage $hwnd 1200 "$PLUGINSDIRimg2.bmp"
 Abort
 InstallBtn:
FunctionEnd
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 预览图片切换功能

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