我正在构建NSIS / MUI2安装程序,我想添加一个自定义页面,该页面播放gif几秒钟,并在该页面上也带有位图,然后自动移至下一页。我似乎无法正确执行。你能指导我怎么做吗?
这是我的代码:
OutFile "Example.exe"
XPStyle on
RequestExecutionLevel admin
!include "MUI2.nsh"
!include nsDialogs.nsh
!include LogicLib.nsh
!include WinCore.nsh ; MAKELONG
!insertmacro MUI_PAGE_WELCOME
Page custom nsDialogsPageEnter nsDialogsPageExit
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
Function nsDialogsPageEnter
nsDialogs::Create 1018
Pop $0
${NSD_CreateBitmap} 30% 30% 80% 80% ""
Pop $0
File "/oname=$pluginsdir\img.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\arrow.bmp"
${NSD_SetImage} $0 "$pluginsdir\img.bmp" $1
newadvsplash::show /NOUNLOAD 1200 250 0 -1 /BANNER /NOCANCEL "$PLUGINSDIR\test.gif"
newadvsplash::hwnd /NOUNLOAD
Pop $0
AnimGif::play /NOUNLOAD /hwnd=$0 "$PLUGINSDIR\test.gif"
;slow functions
Sleep 3000
newadvsplash::stop
AnimGif::stop
nsDialogs::Show
FunctionEnd
Function nsDialogsPageExit
FunctionEnd
Section "-Main"
SectionEnd
答案 0 :(得分:1)
您发布的代码无法提取test.gif!
除此之外,在页面上使用Sleep
通常不是一个好主意,因为它会锁定UI。
在位图控件上播放GIF:
!include "MUI2.nsh"
!include nsDialogs.nsh
!include LogicLib.nsh
!insertmacro MUI_PAGE_WELCOME
Page custom nsDialogsPageEnter
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
Function beginanimfunc
${NSD_KillTimer} ${__FUNCTION__}
${NSD_SetImage} $0 "$pluginsdir\img.bmp" $1
AnimGif::play /NOUNLOAD /HALIGN=0 /VALIGN=0 /HWND=$0 /BGCOL=0x0000ff "$PLUGINSDIR\anim.gif"
${NSD_CreateTimer} stopanimfunc 2000
FunctionEnd
!include WinMessages.nsh
Function stopanimfunc
${NSD_KillTimer} ${__FUNCTION__}
AnimGif::stop
SendMessage $hWndParent ${WM_COMMAND} 1 "" ; Click next button
FunctionEnd
Function nsDialogsPageEnter
nsDialogs::Create 1018
Pop $0
StrCpy $1 ""
${NSD_CreateBitmap} 30% 30% 80% 80% ""
Pop $0
File "/oname=$pluginsdir\img.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\arrow.bmp"
File "/oname=$pluginsdir\anim.gif" "C:\myfiles\myanim.gif"
${NSD_CreateTimer} beginanimfunc 1
nsDialogs::Show
${NSD_FreeImage} $1
FunctionEnd
在启动弹出窗口中播放GIF:
!include "MUI2.nsh"
!include nsDialogs.nsh
!include LogicLib.nsh
!insertmacro MUI_PAGE_WELCOME
Page custom nsDialogsPageEnter
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
!include WinMessages.nsh
Function stopanimfunc
${NSD_KillTimer} ${__FUNCTION__}
newadvsplash::stop /FADEOUT
AnimGif::stop
SendMessage $hWndParent ${WM_COMMAND} 1 "" ; Click next button
FunctionEnd
Function nsDialogsPageEnter
nsDialogs::Create 1018
Pop $0
StrCpy $1 ""
${NSD_CreateBitmap} 30% 30% 80% 80% ""
Pop $0
File "/oname=$pluginsdir\img.bmp" "${NSISDIR}\Contrib\Graphics\Wizard\arrow.bmp"
${NSD_SetImage} $0 "$pluginsdir\img.bmp" $1
File "/oname=$pluginsdir\anim.gif" "C:\myfiles\myanim.gif"
newadvsplash::show /NOUNLOAD 1200 250 0 -1 /BANNER /NOCANCEL /PASSIVE "" ; <- you can put a bitmap here also
newadvsplash::hwnd /NOUNLOAD
Pop $0
AnimGif::play /NOUNLOAD /HALIGN=0 /VALIGN=0 /HWND=$0 /BGCOL=0x0000ff "$PLUGINSDIR\anim.gif"
${NSD_CreateTimer} stopanimfunc 2000
nsDialogs::Show
${NSD_FreeImage} $1
FunctionEnd