ReactOS 0.4.16-dev-963-g182f353
CProgressDlg.hpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Disk Cleanup
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Progress dialog implementation
5 * COPYRIGHT: Copyright 2023-2025 Mark Jansen <mark.jansen@reactos.org>
6 */
7
8#pragma once
9
11{
12 CComPtr<IProgressDialog> m_spProgress;
14public:
15
17 {
18 Stop();
19 }
20
21
22 void Start(DWORD dwTotalSteps, LPCWSTR Title, LPCWSTR Text)
23 {
24 HRESULT hr = CoCreateInstance(CLSID_ProgressDialog, NULL, CLSCTX_INPROC, IID_PPV_ARG(IProgressDialog, &m_spProgress));
26 return;
27
28 m_dwTotal = dwTotalSteps;
29
30 m_spProgress->SetTitle(Title);
31 m_spProgress->SetLine(2, Text, TRUE, NULL);
32 m_spProgress->StartProgressDialog(NULL, NULL, PROGDLG_NOMINIMIZE, NULL);
33 m_spProgress->SetProgress(0, m_dwTotal);
34 }
35
36 void Step(DWORD dwProgress, LPCWSTR Text)
37 {
38 m_spProgress->SetProgress(dwProgress, m_dwTotal);
39 m_spProgress->SetLine(1, Text, TRUE, NULL);
40 }
41
42 void Stop()
43 {
44 if (m_spProgress)
45 {
46 m_spProgress->StopProgressDialog();
47 m_spProgress.Release();
48 }
49 }
50};
CComPtr< IProgressDialog > m_spProgress
void Step(DWORD dwProgress, LPCWSTR Text)
void Start(DWORD dwTotalSteps, LPCWSTR Title, LPCWSTR Text)
char * Text
Definition: combotst.c:136
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static const WCHAR Title[]
Definition: oid.c:1259
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT hr
Definition: shlfolder.c:183
#define PROGDLG_NOMINIMIZE
Definition: shlobj.h:976
#define IID_PPV_ARG(Itype, ppType)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185