2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/mscutils/servman/progress.c
5 * PURPOSE: Progress dialog box message handler
6 * COPYRIGHT: Copyright 2006-2010 Ged Murphy <gedmurphy@reactos.org>
12 #define PROGRESSRANGE 20
15 CompleteProgressBar(HWND hProgDlg
)
20 /* Get a handle to the progress bar */
21 hProgBar
= GetDlgItem(hProgDlg
,
22 IDC_SERVCON_PROGRESS
);
25 /* Get the current position */
26 Pos
= SendMessageW(hProgBar
,
31 /* Loop until we hit the max */
32 while (Pos
<= PROGRESSRANGE
)
34 /* Increment the progress bar */
35 SendMessageW(hProgBar
,
40 /* Wait for 15ms, it gives it a smooth feel */
48 IncrementProgressBar(HWND hProgDlg
,
53 /* Get a handle to the progress bar */
54 hProgBar
= GetDlgItem(hProgDlg
,
55 IDC_SERVCON_PROGRESS
);
58 /* Do we want to increment the default amount? */
59 if (NewPos
== DEFAULT_STEP
)
61 /* Yes, use the step value we set on create */
62 SendMessageW(hProgBar
,
69 /* No, use the value passed */
70 SendMessageW(hProgBar
,
79 InitializeProgressDialog(HWND hProgDlg
,
82 /* Write the service name to the dialog */
83 SendDlgItemMessageW(hProgDlg
,
87 (LPARAM
)lpServiceName
);
89 /* Set the progress bar to the start */
90 SendDlgItemMessageW(hProgDlg
,
98 ProgressDialogProc(HWND hDlg
,
109 /* Get a handle to the progress bar */
110 hProgBar
= GetDlgItem(hDlg
,
111 IDC_SERVCON_PROGRESS
);
113 /* Set the progress bar range */
114 SendMessageW(hProgBar
,
117 MAKELPARAM(0, PROGRESSRANGE
));
119 /* Set the progress bar step */
120 SendMessageW(hProgBar
,
128 switch(LOWORD(wParam
))
145 CreateProgressDialog(HWND hParent
,
151 /* open the progress dialog */
152 hProgDlg
= CreateDialogW(hInstance
,
153 MAKEINTRESOURCEW(IDD_DLG_PROGRESS
),
156 if (hProgDlg
!= NULL
)
158 /* Load the label Id */
159 if (AllocAndLoadString(&lpProgStr
,
163 /* Write it to the dialog */
164 SendDlgItemMessageW(hProgDlg
,
170 HeapFree(GetProcessHeap(),
180 DestroyProgressDialog(HWND hwnd
,
189 /* Complete the progress bar */
190 CompleteProgressBar(hwnd
);
192 /* Wait, for asthetics */
196 bRet
= DestroyWindow(hwnd
);