File: timer.nsi

package info (click to toggle)
nsis 3.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,496 kB
  • sloc: cpp: 39,326; ansic: 27,284; python: 1,386; asm: 712; xml: 409; pascal: 231; makefile: 225; javascript: 67
file content (107 lines) | stat: -rwxr-xr-x 2,035 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
!include LogicLib.nsh
!include nsDialogs.nsh
!include WinMessages.nsh

Name "nsDialogs Timer Example"
OutFile "nsDialogs Timer Example.exe"
XPStyle on
RequestExecutionLevel user

Var DIALOG
Var TEXT
Var PROGBAR
Var PROGBAR2
Var PROGBAR3
Var BUTTON
Var BUTTON2

Page custom nsDialogsPage
!pragma warning disable 8000 ; "Page instfiles not used, no sections will be executed!"

Function OnTimer

	SendMessage $PROGBAR ${PBM_GETPOS} 0 0 $1
	${If} $1 = 100
		SendMessage $PROGBAR ${PBM_SETPOS} 0 0
	${Else}
		SendMessage $PROGBAR ${PBM_DELTAPOS} 10 0
	${EndIf}

FunctionEnd

Function OnTimer2

	SendMessage $PROGBAR2 ${PBM_GETPOS} 0 0 $1
	${If} $1 = 100
		SendMessage $PROGBAR2 ${PBM_SETPOS} 0 0
	${Else}
		SendMessage $PROGBAR2 ${PBM_DELTAPOS} 5 0
	${EndIf}

FunctionEnd

Function OnTimer3

	SendMessage $PROGBAR3 ${PBM_GETPOS} 0 0 $1
	${If} $1 >= 100
		${NSD_KillTimer} OnTimer3
		MessageBox MB_OK "Timer 3 killed"
	${Else}
		SendMessage $PROGBAR3 ${PBM_DELTAPOS} 2 0
	${EndIf}

FunctionEnd

Function OnClick

	Pop $0

	${NSD_KillTimer} OnTimer

FunctionEnd

Function OnClick2

	Pop $0

	${NSD_KillTimer} OnTimer2

FunctionEnd

Function nsDialogsPage

	nsDialogs::Create 1018
	Pop $DIALOG

	${NSD_CreateLabel} 0u 0u 100% 9u "nsDialogs timer example"
	Pop $TEXT

	${NSD_CreateProgressBar} 0u 10u 100% 12u ""
	Pop $PROGBAR

	${NSD_CreateButton} 0u 25u 100u 14u "Kill Timer 1"
	Pop $BUTTON
	${NSD_OnClick} $BUTTON OnClick

	${NSD_CreateProgressBar} 0u 52u 100% 12u ""
	Pop $PROGBAR2
	SendMessage $PROGBAR2 ${PBM_SETBARCOLOR} 0 0x0000FF ; No visual styles
	SendMessage $PROGBAR2 ${PBM_SETSTATE} ${PBST_ERROR} 0 ; Vista+

	${NSD_CreateButton} 0u 67u 100u 14u "Kill Timer 2"
	Pop $BUTTON2
	${NSD_OnClick} $BUTTON2 OnClick2

	${NSD_CreateProgressBar} 0u 114u 100% 12u ""
	Pop $PROGBAR3

	${NSD_CreateTimer} OnTimer 1000
	${NSD_CreateTimer} OnTimer2 100
	${NSD_CreateTimer} OnTimer3 200

	nsDialogs::Show

FunctionEnd

Section
SectionEnd