4 * Copyright 2014 Huw Campbell
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _PROGRESSDIALOG_H_
22 #define _PROGRESSDIALOG_H_
24 class CProgressDialog
:
25 public CComCoClass
<CProgressDialog
, &CLSID_ProgressDialog
>,
26 public CComObjectRootEx
<CComMultiThreadModelNoCS
>,
27 public IProgressDialog
,
39 ULONGLONG ullCompleted
;
41 HWND hwndDisabledParent
;
42 void set_progress_marquee();
43 void update_dialog(DWORD dwUpdate
);
51 progressMark progressClock
[30];
58 virtual HRESULT WINAPI
StartProgressDialog(HWND hwndParent
, IUnknown
*punkEnableModeless
, DWORD dwFlags
, LPCVOID reserved
);
59 virtual HRESULT WINAPI
StopProgressDialog();
60 virtual HRESULT WINAPI
SetTitle(LPCWSTR pwzTitle
);
61 virtual HRESULT WINAPI
SetAnimation(HINSTANCE hInstance
, UINT uiResourceId
);
62 virtual BOOL WINAPI
HasUserCancelled();
63 virtual HRESULT WINAPI
SetProgress64(ULONGLONG ullCompleted
, ULONGLONG ullTotal
);
64 virtual HRESULT WINAPI
SetProgress(DWORD dwCompleted
, DWORD dwTotal
);
65 virtual HRESULT WINAPI
SetLine(DWORD dwLineNum
, LPCWSTR pwzLine
, BOOL bPath
, LPCVOID reserved
);
66 virtual HRESULT WINAPI
SetCancelMsg(LPCWSTR pwzMsg
, LPCVOID reserved
);
67 virtual HRESULT WINAPI
Timer(DWORD dwTimerAction
, LPCVOID reserved
);
70 virtual HRESULT WINAPI
GetWindow(HWND
* phwnd
);
71 virtual HRESULT WINAPI
ContextSensitiveHelp(BOOL fEnterMode
);
73 DECLARE_REGISTRY_RESOURCEID(IDR_PROGRESSDIALOG
)
74 DECLARE_NOT_AGGREGATABLE(CProgressDialog
)
76 DECLARE_PROTECT_FINAL_CONSTRUCT()
78 BEGIN_COM_MAP(CProgressDialog
)
79 COM_INTERFACE_ENTRY_IID(IID_IProgressDialog
, IProgressDialog
)
80 COM_INTERFACE_ENTRY_IID(IID_IOleWindow
, IOleWindow
)
84 static inline void *heap_alloc(size_t size
)
86 return HeapAlloc(GetProcessHeap(), 0, size
);
88 static inline void *heap_alloc_zero(size_t size
)
90 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, size
);
92 static inline void *heap_realloc(void *mem
, size_t size
)
94 return mem
? HeapReAlloc(GetProcessHeap(), 0, mem
, size
) : heap_alloc(size
);
96 static inline BOOL
heap_free(void *mem
)
98 return HeapFree(GetProcessHeap(), 0, mem
);
101 #endif /* _PROGRESSDIALOG_H_ */