mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00

This squashed commit ports back almost all improvements we did to explorer during 0.4.8-dev. Main motivation is: -fixing tons of bugs painting the systray icons, e.g. (but not exclusively) CORE-11378 -and to fix a regression about clock margins CORE-14272 -and the clocks vertical text placement -Win+E behavior CORE-14199 Here is a list of the commits I ported back: [PSDK] shellapi.h 0.4.8-dev-1053-g8b78b0ff98
0.4.8-dev-982-ga64c33e787
0.4.8-dev-970-g9d2139b7d8
[SHELL32]/[REACTOS]/[EXPLORER] 0.4.8-dev-984-g131678a025
0.4.8-dev-971-g5ecabcce59
[EXPLORER] 0.4.8-dev-1065-gf1535c2d6e
tiny part of CORE-14306 0.4.8-dev-1064-gabdde0b764
0.4.8-dev-1054-g3003471e64
0.4.8-dev-974-g04498f3eb5
0.4.8-dev-944-gf5d679aeb9
fixes CORE-14272 Clock Margins 0.4.8-dev-936-g556c485c8b
0.4.8-dev-935-gd11e7af5f2
0.4.8-dev-934-gc109dc9f24
0.4.8-dev-928-g22d1e1017f
0.4.8-dev-925-gc54c5ebb5f
0.4.8-dev-924-g488477d10d
0.4.8-dev-923-g85d7dd4f83
0.4.8-dev-922-g5a1984c998
0.4.8-dev-921-g6c073e9539
0.4.8-dev-920-g455bce68b5
0.4.8-dev-908-g7f35908ad2
0.4.8-dev-860-g3d75cc0814
0.4.8-dev-853-g5ec441a867
0.4.8-dev-852-gbc43733e48
0.4.8-dev-851-gbbca71c4a5
[EXPLORER]&[ROSCTRLS] 0.4.8-dev-789-gcb8cc0d098
0.4.8-dev-788-gbe2bf9b8c5
0.4.8-dev-787-g851e0ca5a8
0.4.8-dev-786-g2abd068398
0.4.8-dev-785-g8c91a00fcf
0.4.8-dev-784-g6c9629bb72
0.4.8-dev-783-gd66c6890f7
0.4.8-dev-691-g2c8ed37605
0.4.8-dev-690-g74e58d938e
0.4.8-dev-669-g4b6d929be1
fixes CORE-14199 0.4.8-dev-46-g2ed535da8a
0.4.8-dev-21-g82b12ef4cf
0.4.8-dev-20-g4238f22396
For now I intentionally did leave out 0.4.8-dev-684-g71e66c69c1
to not make explorer import oleaut32 SysAllocString()/SysFreeString(). I also did not update the translations rc files.
362 lines
9.1 KiB
C
362 lines
9.1 KiB
C
#ifndef _EXPLORER_PRECOMP__H_
|
|
#define _EXPLORER_PRECOMP__H_
|
|
|
|
#define WIN7_COMPAT_MODE 0
|
|
#define WIN7_DEBUG_MODE 0
|
|
|
|
#if WIN7_DEBUG_MODE && !WIN7_COMPAT_MODE
|
|
#undef WIN7_COMPAT_MODE
|
|
#define WIN7_COMPAT_MODE 1
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <tchar.h>
|
|
|
|
#define WIN32_NO_STATUS
|
|
#define _INC_WINDOWS
|
|
#define COM_NO_WINDOWS_H
|
|
|
|
#define COBJMACROS
|
|
|
|
#include <windef.h>
|
|
#include <winbase.h>
|
|
#include <winreg.h>
|
|
#include <wingdi.h>
|
|
#include <winnls.h>
|
|
#include <wincon.h>
|
|
#include <atlbase.h>
|
|
#include <atlcom.h>
|
|
#include <atlwin.h>
|
|
#include <atlstr.h>
|
|
#include <atlcoll.h>
|
|
#include <shellapi.h>
|
|
#include <shlobj.h>
|
|
#include <shlwapi.h>
|
|
#include <uxtheme.h>
|
|
#include <process.h>
|
|
#include <strsafe.h>
|
|
|
|
#include <undocuser.h>
|
|
#include <shlwapi_undoc.h>
|
|
#include <shlobj_undoc.h>
|
|
#include <shlguid_undoc.h>
|
|
#include <undocshell.h>
|
|
|
|
#include <rosctrls.h>
|
|
#include <rosdlgs.h>
|
|
#include <shellutils.h>
|
|
|
|
#include "tmschema.h"
|
|
#include "resource.h"
|
|
|
|
#include <wine/debug.h>
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(explorernew);
|
|
|
|
#define ASSERT(cond) \
|
|
do if (!(cond)) { \
|
|
Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \
|
|
} while (0)
|
|
|
|
extern HINSTANCE hExplorerInstance;
|
|
extern HANDLE hProcessHeap;
|
|
extern HKEY hkExplorer;
|
|
|
|
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
|
|
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
|
|
|
|
/*
|
|
* explorer.c
|
|
*/
|
|
|
|
static inline
|
|
LONG
|
|
SetWindowStyle(IN HWND hWnd,
|
|
IN LONG dwStyleMask,
|
|
IN LONG dwStyle)
|
|
{
|
|
return SHSetWindowBits(hWnd, GWL_STYLE, dwStyleMask, dwStyle);
|
|
}
|
|
|
|
static inline
|
|
LONG
|
|
SetWindowExStyle(IN HWND hWnd,
|
|
IN LONG dwStyleMask,
|
|
IN LONG dwStyle)
|
|
{
|
|
return SHSetWindowBits(hWnd, GWL_EXSTYLE, dwStyleMask, dwStyle);
|
|
}
|
|
|
|
HMENU
|
|
LoadPopupMenu(IN HINSTANCE hInstance,
|
|
IN LPCWSTR lpMenuName);
|
|
|
|
HMENU
|
|
FindSubMenu(IN HMENU hMenu,
|
|
IN UINT uItem,
|
|
IN BOOL fByPosition);
|
|
|
|
BOOL
|
|
GetCurrentLoggedOnUserName(OUT LPWSTR szBuffer,
|
|
IN DWORD dwBufferSize);
|
|
|
|
BOOL
|
|
FormatMenuString(IN HMENU hMenu,
|
|
IN UINT uPosition,
|
|
IN UINT uFlags,
|
|
...);
|
|
|
|
BOOL
|
|
GetExplorerRegValueSet(IN HKEY hKey,
|
|
IN LPCWSTR lpSubKey,
|
|
IN LPCWSTR lpValue);
|
|
|
|
/*
|
|
* rshell.c
|
|
*/
|
|
|
|
VOID InitRSHELL(VOID);
|
|
HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv);
|
|
HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk);
|
|
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop);
|
|
DWORD WINAPI _WinList_Init(void);
|
|
void WINAPI _ShellDDEInit(BOOL bInit);
|
|
HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv);
|
|
HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv);
|
|
|
|
/*
|
|
* traywnd.c
|
|
*/
|
|
|
|
#define TWM_OPENSTARTMENU (WM_USER + 260)
|
|
#define TWM_SETTINGSCHANGED (WM_USER + 300)
|
|
|
|
extern const GUID IID_IShellDesktopTray;
|
|
|
|
#define INTERFACE ITrayWindow
|
|
DECLARE_INTERFACE_(ITrayWindow, IUnknown)
|
|
{
|
|
/*** IUnknown methods ***/
|
|
STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE;
|
|
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
|
|
STDMETHOD_(ULONG, Release) (THIS) PURE;
|
|
/*** ITrayWindow methods ***/
|
|
STDMETHOD_(HRESULT, Open) (THIS) PURE;
|
|
STDMETHOD_(HRESULT, Close) (THIS) PURE;
|
|
STDMETHOD_(HWND, GetHWND) (THIS) PURE;
|
|
STDMETHOD_(BOOL, IsSpecialHWND) (THIS_ HWND hWnd) PURE;
|
|
STDMETHOD_(BOOL, IsHorizontal) (THIS) PURE;
|
|
STDMETHOD_(HWND, DisplayProperties) (THIS) PURE;
|
|
STDMETHOD_(BOOL, ExecContextMenuCmd) (THIS_ UINT uiCmd) PURE;
|
|
STDMETHOD_(BOOL, Lock) (THIS_ BOOL bLock) PURE;
|
|
};
|
|
#undef INTERFACE
|
|
|
|
#if defined(COBJMACROS)
|
|
/*** IUnknown methods ***/
|
|
#define ITrayWindow_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
|
#define ITrayWindow_AddRef(p) (p)->lpVtbl->AddRef(p)
|
|
#define ITrayWindow_Release(p) (p)->lpVtbl->Release(p)
|
|
/*** ITrayWindow methods ***/
|
|
#define ITrayWindow_Open(p) (p)->lpVtbl->Open(p)
|
|
#define ITrayWindow_Close(p) (p)->lpVtbl->Close(p)
|
|
#define ITrayWindow_GetHWND(p) (p)->lpVtbl->GetHWND(p)
|
|
#define ITrayWindow_IsSpecialHWND(p,a) (p)->lpVtbl->IsSpecialHWND(p,a)
|
|
#define ITrayWindow_IsHorizontal(p) (p)->lpVtbl->IsHorizontal(p)
|
|
#define ITrayWindow_DisplayProperties(p) (p)->lpVtbl->DisplayProperties(p)
|
|
#define ITrayWindow_ExecContextMenuCmd(p,a) (p)->lpVtbl->ExecContextMenuCmd(p,a)
|
|
#define ITrayWindow_Lock(p,a) (p)->lpVtbl->Lock(p,a)
|
|
#endif
|
|
|
|
BOOL
|
|
RegisterTrayWindowClass(VOID);
|
|
|
|
VOID
|
|
UnregisterTrayWindowClass(VOID);
|
|
|
|
HRESULT CreateTrayWindow(ITrayWindow ** ppTray);
|
|
|
|
VOID
|
|
TrayProcessMessages(IN OUT ITrayWindow *Tray);
|
|
|
|
VOID
|
|
TrayMessageLoop(IN OUT ITrayWindow *Tray);
|
|
|
|
/*
|
|
* settings.c
|
|
*/
|
|
|
|
typedef struct _TW_STUCKRECTS2
|
|
{
|
|
DWORD cbSize;
|
|
LONG Unknown;
|
|
union
|
|
{
|
|
DWORD dwFlags;
|
|
struct
|
|
{
|
|
DWORD AutoHide : 1;
|
|
DWORD AlwaysOnTop : 1;
|
|
DWORD SmallIcons : 1;
|
|
DWORD HideClock : 1;
|
|
};
|
|
};
|
|
DWORD Position;
|
|
SIZE Size;
|
|
RECT Rect;
|
|
} TW_STRUCKRECTS2, *PTW_STUCKRECTS2;
|
|
|
|
struct TaskbarSettings
|
|
{
|
|
BOOL bLock;
|
|
BOOL bGroupButtons;
|
|
BOOL bShowSeconds;
|
|
BOOL bHideInactiveIcons;
|
|
TW_STRUCKRECTS2 sr;
|
|
|
|
BOOL Load();
|
|
BOOL Save();
|
|
};
|
|
|
|
extern TaskbarSettings g_TaskbarSettings;
|
|
|
|
/*
|
|
* shellservice.cpp
|
|
*/
|
|
HRESULT InitShellServices(HDPA * phdpa);
|
|
HRESULT ShutdownShellServices(HDPA hdpa);
|
|
|
|
/*
|
|
* startup.cpp
|
|
*/
|
|
|
|
int
|
|
ProcessStartupItems(VOID);
|
|
|
|
/*
|
|
* trayprop.h
|
|
*/
|
|
|
|
VOID
|
|
DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar);
|
|
|
|
/*
|
|
* desktop.cpp
|
|
*/
|
|
HANDLE
|
|
DesktopCreateWindow(IN OUT ITrayWindow *Tray);
|
|
|
|
VOID
|
|
DesktopDestroyShellWindow(IN HANDLE hDesktop);
|
|
|
|
|
|
/*
|
|
* notifyiconscust.cpp
|
|
*/
|
|
VOID
|
|
ShowCustomizeNotifyIcons(HINSTANCE, HWND);
|
|
|
|
/*
|
|
* taskband.cpp
|
|
*/
|
|
|
|
extern const GUID CLSID_ITaskBand; /* Internal Task Band CLSID */
|
|
HRESULT CTaskBand_CreateInstance(IN ITrayWindow *Tray, HWND hWndStartButton, REFIID riid, void **ppv);
|
|
|
|
/*
|
|
* tbsite.cpp
|
|
*/
|
|
|
|
#define INTERFACE ITrayBandSite
|
|
DECLARE_INTERFACE_(ITrayBandSite, IUnknown)
|
|
{
|
|
/*** IUnknown methods ***/
|
|
STDMETHOD_(HRESULT, QueryInterface) (THIS_ REFIID riid, void** ppvObject) PURE;
|
|
STDMETHOD_(ULONG, AddRef) (THIS) PURE;
|
|
STDMETHOD_(ULONG, Release) (THIS) PURE;
|
|
/*** IBandSiteStreamCallback ***/
|
|
STDMETHOD_(HRESULT, OnLoad)(THIS_ IStream *pStm, REFIID riid, PVOID *pvObj) PURE;
|
|
STDMETHOD_(HRESULT, OnSave)(THIS_ IUnknown *pUnk, IStream *pStm) PURE;
|
|
/*** ITrayBandSite methods ***/
|
|
STDMETHOD_(HRESULT, IsTaskBand) (THIS_ IUnknown *punk) PURE;
|
|
STDMETHOD_(HRESULT, ProcessMessage) (THIS_ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) PURE;
|
|
STDMETHOD_(HRESULT, AddContextMenus) (THIS_ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags, IContextMenu **ppcm) PURE;
|
|
STDMETHOD_(HRESULT, Lock) (THIS_ BOOL bLock) PURE;
|
|
};
|
|
#undef INTERFACE
|
|
|
|
#if defined(COBJMACROS)
|
|
/*** IUnknown methods ***/
|
|
#define ITrayBandSite_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
|
#define ITrayBandSite_AddRef(p) (p)->lpVtbl->AddRef(p)
|
|
#define ITrayBandSite_Release(p) (p)->lpVtbl->Release(p)
|
|
/*** IBandSiteStreamCallback methods ***/
|
|
#define ITrayBandSite_OnLoad(p,a,b,c) (p)->lpVtbl->OnLoad(p,a,b,c)
|
|
#define ITrayBandSite_OnSave(p,a,b) (p)->lpVtbl->OnSave(p,a,b)
|
|
/*** ITrayBandSite methods ***/
|
|
#define ITrayBandSite_IsTaskBand(p,a) (p)->lpVtbl->IsTaskBand(p,a)
|
|
#define ITrayBandSite_ProcessMessage(p,a,b,c,d,e) (p)->lpVtbl->ProcessMessage(p,a,b,c,d,e)
|
|
#define ITrayBandSite_AddContextMenus(p,a,b,c,d,e,f) (p)->lpVtbl->AddContextMenus(p,a,b,c,d,e,f)
|
|
#define ITrayBandSite_Lock(p,a) (p)->lpVtbl->Lock(p,a)
|
|
#endif
|
|
|
|
HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand* pTaskBand, OUT ITrayBandSite** pBandSite);
|
|
|
|
/*
|
|
* startmnu.cpp
|
|
*/
|
|
|
|
HRESULT StartMenuBtnCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu);
|
|
|
|
IMenuPopup*
|
|
CreateStartMenu(IN ITrayWindow *Tray,
|
|
OUT IMenuBand **ppMenuBand,
|
|
IN HBITMAP hbmBanner OPTIONAL,
|
|
IN BOOL bSmallIcons);
|
|
|
|
/*
|
|
* startmnucust.cpp
|
|
*/
|
|
VOID
|
|
ShowCustomizeClassic(HINSTANCE, HWND);
|
|
|
|
/*
|
|
* startmnusite.cpp
|
|
*/
|
|
|
|
HRESULT
|
|
CreateStartMenuSite(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv);
|
|
|
|
/*
|
|
* trayntfy.c
|
|
*/
|
|
|
|
/* TrayClockWnd */
|
|
HRESULT CTrayClockWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv);
|
|
|
|
/* TrayNotifyWnd */
|
|
#define TNWM_GETMINIMUMSIZE (WM_USER + 0x100)
|
|
#define TNWM_CHANGETRAYPOS (WM_USER + 0x104)
|
|
|
|
#define NTNWM_REALIGN (0x1)
|
|
|
|
HRESULT CTrayNotifyWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv);
|
|
|
|
/* SysPagerWnd */
|
|
HRESULT CSysPagerWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv);
|
|
|
|
/*
|
|
* taskswnd.c
|
|
*/
|
|
|
|
#define TSWM_UPDATETASKBARPOS (WM_USER + 2)
|
|
|
|
HRESULT CTaskSwitchWnd_CreateInstance(IN HWND hWndParent, IN OUT ITrayWindow *Tray, REFIID riid, void **ppv);
|
|
|
|
HRESULT
|
|
Tray_OnStartMenuDismissed(ITrayWindow* Tray);
|
|
|
|
HRESULT
|
|
IsSameObject(IN IUnknown *punk1, IN IUnknown *punk2);
|
|
|
|
#endif /* _EXPLORER_PRECOMP__H_ */
|