but when i use from sleep,timer It also stops! I don't wanna sleep effect on the timer process....
Example1:
after open run,if click on install button the progressbar too sleeping!
i want sleep, Without affecting the timer
!include "mui2.nsh"
Page Custom My_Custom_Page_Show My_Custom_Page_Leave
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
Var Label
Var ProgressBar
Var ProgressBar_Counter
Var BMP_SlideShow
Var SlideShow_Type
Var Dialog
Section
SectionEnd
Function My_Custom_Page_Show
nsDialogs::Create 1018
Pop $Dialog
${IF} $Dialog == error
Abort
${EndIF}
##-----------------------------------------------
${NSD_CreateLabel} 50 30 50 14 ""
Pop $Label
#------------------------------------------------
##-----------------------------------------------
${NSD_CreateProgressBar} 50 50 80% 20 ""
Pop $ProgressBar
StrCpy $ProgressBar_Counter 100
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
EnableWindow $ProgressBar 0
#------------------------------------------------
##-----------------------------------------------
${NSD_CreateBitmap} 50 80 100% 100% ""
Pop $BMP_SlideShow
EnableWindow $BMP_SlideShow 0
${NSD_SetImage} $BMP_SlideShow "$EXEDIR\a.bmp" $0
StrCpy $SlideShow_Type "a.bmp"
#------------------------------------------------
##-----------------------------------------------
${NSD_CreateTimer} ProgressBarPRO.Callback 10
#------------------------------------------------
nsDialogs::Show
FunctionEnd
Function ProgressBarPRO.Callback
${IF} $SlideShow_Type S== "a.bmp"
IntOp $ProgressBar_Counter $ProgressBar_Counter - 1
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${IF} $ProgressBar_Counter S== 0
StrCpy $ProgressBar_Counter 100
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${NSD_SetImage} $BMP_SlideShow "$EXEDIR\b.bmp" $0
StrCpy $SlideShow_Type "b.bmp"
${EndIF}
${ElseIF} $SlideShow_Type S== "b.bmp"
IntOp $ProgressBar_Counter $ProgressBar_Counter - 1
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${IF} $ProgressBar_Counter S== 0
StrCpy $ProgressBar_Counter 100
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${NSD_SetImage} $BMP_SlideShow "$EXEDIR\a.bmp" $0
StrCpy $SlideShow_Type "a.bmp"
${EndIF}
${EndIF}
FunctionEnd
Function My_Custom_Page_Leave
StrCpy $0 0
BCK:
IntOp $0 $0 + 1
${NSD_SETTEXT} $Label "Sleep $0 Sec"
${IF} $0 <= 3
Sleep 1000
Goto BCK
${Else}
;MessageBox MB_OK "3"
${NSD_SETTEXT} $Label ""
${ENDIF}
Abort
FunctionEnd
Example2:
also in this example,sleep affecting on the timer!
!include "mui2.nsh"
Page Custom My_Custom_Page_Show ;My_Custom_Page_Leave
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
Var Label
Var ProgressBar
Var ProgressBar_Counter
Var BMP_SlideShow
Var SlideShow_Type
Var Dialog
Section
SectionEnd
Function My_Custom_Page_Show
nsDialogs::Create 1018
Pop $Dialog
${IF} $Dialog == error
Abort
${EndIF}
##-----------------------------------------------
${NSD_CreateLabel} 50 30 50 14 ""
Pop $Label
#------------------------------------------------
##-----------------------------------------------
${NSD_CreateProgressBar} 50 50 80% 20 ""
Pop $ProgressBar
StrCpy $ProgressBar_Counter 100
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
EnableWindow $ProgressBar 0
#------------------------------------------------
##-----------------------------------------------
${NSD_CreateBitmap} 50 80 100% 100% ""
Pop $BMP_SlideShow
EnableWindow $BMP_SlideShow 0
${NSD_SetImage} $BMP_SlideShow "$EXEDIR\a.bmp" $0
StrCpy $SlideShow_Type "a.bmp"
#------------------------------------------------
##-----------------------------------------------
${NSD_CreateTimer} Sleep.Callback 10
#------------------------------------------------
##-----------------------------------------------
${NSD_CreateTimer} ProgressBarPRO.Callback 10
#------------------------------------------------
nsDialogs::Show
FunctionEnd
Function ProgressBarPRO.Callback
${IF} $SlideShow_Type S== "a.bmp"
IntOp $ProgressBar_Counter $ProgressBar_Counter - 1
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${IF} $ProgressBar_Counter S== 0
StrCpy $ProgressBar_Counter 100
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${NSD_SetImage} $BMP_SlideShow "$EXEDIR\b.bmp" $0
StrCpy $SlideShow_Type "b.bmp"
${EndIF}
${ElseIF} $SlideShow_Type S== "b.bmp"
IntOp $ProgressBar_Counter $ProgressBar_Counter - 1
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${IF} $ProgressBar_Counter S== 0
StrCpy $ProgressBar_Counter 100
SendMessage $ProgressBar ${PBM_SETPOS} $ProgressBar_Counter 0
${NSD_SetImage} $BMP_SlideShow "$EXEDIR\a.bmp" $0
StrCpy $SlideShow_Type "a.bmp"
${EndIF}
${EndIF}
FunctionEnd
Function Sleep.Callback
${NSD_KillTimer} Sleep.Callback
StrCpy $0 0
BCK:
IntOp $0 $0 + 1
${NSD_SETTEXT} $Label "Sleep $0 Sec"
${IF} $0 <= 3
Sleep 1000
Goto BCK
${Else}
;MessageBox MB_OK "3"
${NSD_SETTEXT} $Label ""
${NSD_CreateTimer} Sleep.Callback 10
${ENDIF}
FunctionEnd