[NTOS:IO]
[reactos.git] / reactos / base / shell / explorer / precomp.h
1 #ifndef _EXPLORER_PRECOMP__H_
2 #define _EXPLORER_PRECOMP__H_
3
4 #define WIN7_COMPAT_MODE 0
5 #define WIN7_DEBUG_MODE 0
6
7 #if WIN7_DEBUG_MODE && !WIN7_COMPAT_MODE
8 #undef WIN7_COMPAT_MODE
9 #define WIN7_COMPAT_MODE 1
10 #endif
11
12 #include <stdio.h>
13 #include <tchar.h>
14
15 #define WIN32_NO_STATUS
16 #define _INC_WINDOWS
17 #define COM_NO_WINDOWS_H
18
19 #define COBJMACROS
20
21 #include <windef.h>
22 #include <winbase.h>
23 #include <winreg.h>
24 #include <wingdi.h>
25 #include <winnls.h>
26 #include <wincon.h>
27 #include <atlbase.h>
28 #include <atlcom.h>
29 #include <atlwin.h>
30 #include <shellapi.h>
31 #include <shlobj.h>
32 #include <shlwapi.h>
33 #include <uxtheme.h>
34 #include <strsafe.h>
35
36 #include <undocuser.h>
37 #include <shlwapi_undoc.h>
38 #include <shlobj_undoc.h>
39 #include <shlguid_undoc.h>
40 #include <undocshell.h>
41
42 #include <rosctrls.h>
43 #include <shellutils.h>
44
45 #include "tmschema.h"
46 #include "resource.h"
47
48 #include <wine/debug.h>
49
50 WINE_DEFAULT_DEBUG_CHANNEL(explorernew);
51
52 #define ASSERT(cond) \
53 do if (!(cond)) { \
54 Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \
55 } while (0)
56
57 extern HINSTANCE hExplorerInstance;
58 extern HANDLE hProcessHeap;
59 extern HKEY hkExplorer;
60
61 /*
62 * explorer.c
63 */
64
65 static inline
66 LONG
67 SetWindowStyle(IN HWND hWnd,
68 IN LONG dwStyleMask,
69 IN LONG dwStyle)
70 {
71 return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle);
72 }
73
74 static inline
75 LONG
76 SetWindowExStyle(IN HWND hWnd,
77 IN LONG dwStyleMask,
78 IN LONG dwStyle)
79 {
80 return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle);
81 }
82
83 HMENU
84 LoadPopupMenu(IN HINSTANCE hInstance,
85 IN LPCWSTR lpMenuName);
86
87 HMENU
88 FindSubMenu(IN HMENU hMenu,
89 IN UINT uItem,
90 IN BOOL fByPosition);
91
92 BOOL
93 GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer,
94 IN DWORD dwBufferSize);
95
96 BOOL
97 FormatMenuString(IN HMENU hMenu,
98 IN UINT uPosition,
99 IN UINT uFlags,
100 ...);
101
102 BOOL
103 GetExplorerRegValueSet(IN HKEY hKey,
104 IN LPCWSTR lpSubKey,
105 IN LPCWSTR lpValue);
106
107 /*
108 * rshell.c
109 */
110
111 HRESULT WINAPI _CStartMenu_Constructor(REFIID riid, void **ppv);
112 HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk);
113 BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop);
114 DWORD WINAPI _WinList_Init(void);
115 void WINAPI _ShellDDEInit(BOOL bInit);
116
117 /*
118 * traywnd.c
119 */
120
121 #define TWM_OPENSTARTMENU (WM_USER + 260)
122
123 extern const GUID IID_IShellDesktopTray;
124
125 #define INTERFACE ITrayWindow
126 DECLARE_INTERFACE_(ITrayWindow, IUnknown)
127 {
128 /*** IUnknown methods ***/
129 STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE;
130 STDMETHOD_(ULONG, AddRef) (THIS) PURE;
131 STDMETHOD_(ULONG, Release) (THIS) PURE;
132 /*** ITrayWindow methods ***/
133 STDMETHOD_(HRESULT, Open) (THIS) PURE;
134 STDMETHOD_(HRESULT, Close) (THIS) PURE;
135 STDMETHOD_(HWND, GetHWND) (THIS) PURE;
136 STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE;
137 STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE;
138 STDMETHOD_(HFONT, GetCaptionFonts) (THIS_ HFONT *phBoldCaption) PURE;
139 STDMETHOD_(HWND, DisplayProperties) (THIS) PURE;
140 STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE;
141 STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE;
142 };
143 #undef INTERFACE
144
145 #if defined(COBJMACROS)
146 /*** IUnknown methods ***/
147 #define ITrayWindow_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
148 #define ITrayWindow_AddRef(p) (p)->lpVtbl->AddRef(p)
149 #define ITrayWindow_Release(p) (p)->lpVtbl->Release(p)
150 /*** ITrayWindow methods ***/
151 #define ITrayWindow_Open(p) (p)->lpVtbl->Open(p)
152 #define ITrayWindow_Close(p) (p)->lpVtbl->Close(p)
153 #define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p)
154 #define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a)
155 #define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p)
156 #define ITrayWindow_GetCaptionFonts(p,a) (p)->lpVtbl->GetCaptionFonts(p,a)
157 #define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p)
158 #define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a)
159 #define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a)
160 #endif
161
162 BOOL
163 RegisterTrayWindowClass(VOID);
164
165 VOID
166 UnregisterTrayWindowClass(VOID);
167
168 HRESULT CreateTrayWindow(ITrayWindow ** ppTray);
169
170 VOID
171 TrayProcessMessages(IN OUT ITrayWindow *Tray);
172
173 VOID
174 TrayMessageLoop(IN OUT ITrayWindow *Tray);
175
176 /*
177 * settings.c
178 */
179
180 /* Structure to hold non-default options*/
181 typedef struct _ADVANCED_SETTINGS
182 {
183 BOOL bShowSeconds;
184 } ADVANCED_SETTINGS, *PADVANCED_SETTINGS;
185
186 extern ADVANCED_SETTINGS AdvancedSettings;
187 extern const TCHAR szAdvancedSettingsKey [];
188
189 VOID
190 LoadAdvancedSettings(VOID);
191
192 BOOL
193 SaveSettingDword(IN LPCWSTR pszKeyName,
194 IN LPCWSTR pszValueName,
195 IN DWORD dwValue);
196
197 /*
198 * shellservice.cpp
199 */
200 HRESULT InitShellServices(HDPA * phdpa);
201 HRESULT ShutdownShellServices(HDPA hdpa);
202
203 /*
204 * startup.cpp
205 */
206
207 int
208 ProcessStartupItems(VOID);
209
210 /*
211 * trayprop.h
212 */
213
214 VOID
215 DisplayTrayProperties(IN HWND hwndOwner);
216
217 /*
218 * desktop.cpp
219 */
220 HANDLE
221 DesktopCreateWindow(IN OUT ITrayWindow *Tray);
222
223 VOID
224 DesktopDestroyShellWindow(IN HANDLE hDesktop);
225
226
227 /*
228 * notifyiconscust.cpp
229 */
230 VOID
231 ShowCustomizeNotifyIcons(HINSTANCE, HWND);
232
233 /*
234 * taskband.cpp
235 */
236
237 /* Internal Task Band CLSID */
238 extern const GUID CLSID_ITaskBand;
239
240 #define INTERFACE ITaskBand
241 DECLARE_INTERFACE_(ITaskBand, IUnknown)
242 {
243 /*** IUnknown methods ***/
244 STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE;
245 STDMETHOD_(ULONG, AddRef) (THIS) PURE;
246 STDMETHOD_(ULONG, Release) (THIS) PURE;
247 /*** ITaskBand methods ***/
248 STDMETHOD_(HRESULT, GetRebarBandID)(THIS_ DWORD *pdwBandID) PURE;
249 };
250 #undef INTERFACE
251
252 #if defined(COBJMACROS)
253 /*** IUnknown methods ***/
254 #define ITaskBand_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
255 #define ITaskBand_AddRef(p) (p)->lpVtbl->AddRef(p)
256 #define ITaskBand_Release(p) (p)->lpVtbl->Release(p)
257 /*** ITaskBand methods ***/
258 #define ITaskBand_GetRebarBandID(p,a) (p)->lpVtbl->GetRebarBandID(p,a)
259 #endif
260
261 ITaskBand *
262 CreateTaskBand(IN OUT ITrayWindow *Tray);
263
264 /*
265 * tbsite.cpp
266 */
267
268 #define INTERFACE ITrayBandSite
269 DECLARE_INTERFACE_(ITrayBandSite, IUnknown)
270 {
271 /*** IUnknown methods ***/
272 STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE;
273 STDMETHOD_(ULONG, AddRef) (THIS) PURE;
274 STDMETHOD_(ULONG, Release) (THIS) PURE;
275 /*** IBandSiteStreamCallback ***/
276 STDMETHOD_(HRESULT, OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE;
277 STDMETHOD_(HRESULT, OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE;
278 /*** ITrayBandSite methods ***/
279 STDMETHOD_(HRESULT, IsTaskBand) (THIS_ IUnknown *punk) PURE;
280 STDMETHOD_(HRESULT, ProcessMessage) (THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) PURE;
281 STDMETHOD_(HRESULT, AddContextMenus) (THIS_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags, IContextMenu **ppcm) PURE;
282 STDMETHOD_(HRESULT, Lock) (THIS_ BOOL bLock) PURE;
283 };
284 #undef INTERFACE
285
286 #if defined(COBJMACROS)
287 /*** IUnknown methods ***/
288 #define ITrayBandSite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
289 #define ITrayBandSite_AddRef(p) (p)->lpVtbl->AddRef(p)
290 #define ITrayBandSite_Release(p) (p)->lpVtbl->Release(p)
291 /*** IBandSiteStreamCallback methods ***/
292 #define ITrayBandSite_OnLoad(p,a,b,c) (p)->lpVtbl->OnLoad(p,a,b,c)
293 #define ITrayBandSite_OnSave(p,a,b) (p)->lpVtbl->OnSave(p,a,b)
294 /*** ITrayBandSite methods ***/
295 #define ITrayBandSite_IsTaskBand(p,a) (p)->lpVtbl->IsTaskBand(p,a)
296 #define ITrayBandSite_ProcessMessage(p,a,b,c,d,e) (p)->lpVtbl->ProcessMessage(p,a,b,c,d,e)
297 #define ITrayBandSite_AddContextMenus(p,a,b,c,d,e,f) (p)->lpVtbl->AddContextMenus(p,a,b,c,d,e,f)
298 #define ITrayBandSite_Lock(p,a) (p)->lpVtbl->Lock(p,a)
299 #endif
300
301 ITrayBandSite *
302 CreateTrayBandSite(IN OUT ITrayWindow *Tray,
303 OUT HWND *phWndRebar,
304 OUT HWND *phWndTaskSwitch);
305
306 /*
307 * startmnu.cpp
308 */
309
310 HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu);
311
312 IMenuPopup*
313 CreateStartMenu(IN ITrayWindow *Tray,
314 OUT IMenuBand **ppMenuBand,
315 IN HBITMAP hbmBanner OPTIONAL,
316 IN BOOL bSmallIcons);
317
318 /*
319 * startmnucust.cpp
320 */
321 VOID
322 ShowCustomizeClassic(HINSTANCE, HWND);
323
324 /*
325 * startmnusite.cpp
326 */
327
328 HRESULT
329 CreateStartMenuSite(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv);
330
331 /*
332 * trayntfy.c
333 */
334
335 /* TrayClockWnd */
336 #define TCWM_GETMINIMUMSIZE (WM_USER + 0x100)
337 #define TCWM_UPDATETIME (WM_USER + 0x101)
338
339 /* TrayNotifyWnd */
340 #define TNWM_GETMINIMUMSIZE (WM_USER + 0x100)
341 #define TNWM_UPDATETIME (WM_USER + 0x101)
342 #define TNWM_SHOWCLOCK (WM_USER + 0x102)
343 #define TNWM_SHOWTRAY (WM_USER + 0x103)
344 #define TNWM_CHANGETRAYPOS (WM_USER + 0x104)
345
346 #define NTNWM_REALIGN (0x1)
347
348 class CTrayNotifyWnd;
349
350 BOOL
351 RegisterTrayNotifyWndClass(VOID);
352
353 VOID
354 UnregisterTrayNotifyWndClass(VOID);
355
356 HWND
357 CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow, IN BOOL bHideClock, CTrayNotifyWnd** ppTrayNotify);
358
359 BOOL
360 TrayNotify_NotifyIconCmd(CTrayNotifyWnd* pTrayNotify, IN WPARAM wParam, IN LPARAM lParam);
361
362 BOOL
363 TrayNotify_GetClockRect(CTrayNotifyWnd* pTrayNotify, OUT PRECT rcClock);
364
365 /*
366 * taskswnd.c
367 */
368
369 #define TSWM_ENABLEGROUPING (WM_USER + 1)
370 #define TSWM_UPDATETASKBARPOS (WM_USER + 2)
371
372 BOOL
373 RegisterTaskSwitchWndClass(VOID);
374
375 VOID
376 UnregisterTaskSwitchWndClass(VOID);
377
378 HWND
379 CreateTaskSwitchWnd(IN HWND hWndParent,
380 IN OUT ITrayWindow *Tray);
381
382 HRESULT
383 Tray_OnStartMenuDismissed(ITrayWindow* Tray);
384
385 HRESULT
386 IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2);
387
388 #endif /* _EXPLORER_PRECOMP__H_ */