Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

676 lines
21 KiB

  1. #ifndef _TRAY_H
  2. #define _TRAY_H
  3. #include "trayp.h"
  4. #include "cwndproc.h"
  5. #ifdef __cplusplus
  6. #include "traynot.h"
  7. #include "ssomgr.h"
  8. typedef struct tagHWNDANDPLACEMENT
  9. {
  10. HWND hwnd;
  11. BOOL fRestore;
  12. WINDOWPLACEMENT wp;
  13. }
  14. HWNDANDPLACEMENT, *LPHWNDANDPLACEMENT;
  15. typedef struct tagAPPBAR
  16. {
  17. HWND hwnd;
  18. UINT uCallbackMessage;
  19. RECT rc;
  20. UINT uEdge;
  21. }
  22. APPBAR, *PAPPBAR;
  23. typedef struct tagWINDOWPOSITIONS
  24. {
  25. UINT idRes;
  26. HDSA hdsaWP;
  27. }
  28. WINDOWPOSITIONS, *LPWINDOWPOSITIONS;
  29. typedef struct tagTRAYVIEWOPTS
  30. {
  31. BOOL fAlwaysOnTop;
  32. BOOL fSMSmallIcons;
  33. BOOL fHideClock;
  34. BOOL fNoTrayItemsDisplayPolicyEnabled;
  35. BOOL fNoAutoTrayPolicyEnabled;
  36. BOOL fAutoTrayEnabledByUser;
  37. BOOL fShowQuickLaunch;
  38. UINT uAutoHide; // AH_HIDING , AH_ON
  39. }
  40. TRAYVIEWOPTS;
  41. // TVSD Flags.
  42. #define TVSD_NULL 0x0000
  43. #define TVSD_AUTOHIDE 0x0001
  44. #define TVSD_TOPMOST 0x0002
  45. #define TVSD_SMSMALLICONS 0x0004
  46. #define TVSD_HIDECLOCK 0x0008
  47. // old Win95 TVSD struct
  48. typedef struct _TVSD95
  49. {
  50. DWORD dwSize;
  51. LONG cxScreen;
  52. LONG cyScreen;
  53. LONG dxLeft;
  54. LONG dxRight;
  55. LONG dyTop;
  56. LONG dyBottom;
  57. DWORD uAutoHide;
  58. RECTL rcAutoHide;
  59. DWORD uStuckPlace;
  60. DWORD dwFlags;
  61. } TVSD95;
  62. // Nashville tray save data
  63. typedef struct _TVSD
  64. {
  65. DWORD dwSize;
  66. LONG lSignature; // signature (must be negative)
  67. DWORD dwFlags; // TVSD_ flags
  68. DWORD uStuckPlace; // current stuck edge
  69. SIZE sStuckWidths; // widths of stuck rects
  70. RECT rcLastStuck; // last stuck position in pixels
  71. } TVSD;
  72. // convenient union for reading either
  73. typedef union _TVSDCOMPAT
  74. {
  75. TVSD t; // new format
  76. TVSD95 w95; // old format
  77. } TVSDCOMPAT;
  78. #define TVSDSIG_CURRENT (-1L)
  79. #define IS_CURRENT_TVSD(t) ((t.dwSize >= sizeof(TVSD)) && (t.lSignature < 0))
  80. #define MAYBE_WIN95_TVSD(t) (t.dwSize == sizeof(TVSD95))
  81. DWORD _GetDefaultTVSDFlags();
  82. class CTray;
  83. class CDropTargetBase : public IDropTarget
  84. {
  85. public:
  86. // *** IUnknown methods ***
  87. STDMETHODIMP QueryInterface(REFIID riid, void ** ppvObj);
  88. STDMETHODIMP_(ULONG) AddRef();
  89. STDMETHODIMP_(ULONG) Release();
  90. // *** IDropTarget methods ***
  91. STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect);
  92. STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  93. STDMETHODIMP DragLeave();
  94. STDMETHODIMP Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect);
  95. CDropTargetBase(CTray* ptray) : _ptray(ptray) {}
  96. protected:
  97. CTray* _ptray;
  98. };
  99. class CTrayDropTarget : public CDropTargetBase
  100. {
  101. public:
  102. // *** IDropTarget methods ***
  103. STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect);
  104. STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  105. CTrayDropTarget();
  106. };
  107. class CStartDropTarget : public CDropTargetBase
  108. {
  109. public:
  110. // *** IDropTarget methods ***
  111. STDMETHODIMP DragEnter(IDataObject *pdtobj, DWORD grfKeyState, POINTL ptl, DWORD *pdwEffect);
  112. STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  113. STDMETHODIMP DragLeave();
  114. STDMETHODIMP Drop(IDataObject *pdtobj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
  115. CStartDropTarget();
  116. protected:
  117. HRESULT _GetStartMenuDropTarget(IDropTarget** pptgt);
  118. void _StartAutoOpenTimer(POINTL *pptl);
  119. DWORD _dwEffectsAllowed;
  120. };
  121. class CDeskTray : public IDeskTray
  122. {
  123. public:
  124. // *** IUnknown methods ***
  125. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  126. STDMETHODIMP_(ULONG)AddRef();
  127. STDMETHODIMP_(ULONG) Release();
  128. // *** IDeskTray methods ***
  129. STDMETHODIMP_(UINT) AppBarGetState();
  130. STDMETHODIMP GetTrayWindow(HWND* phwndTray);
  131. STDMETHODIMP SetDesktopWindow(HWND hwndDesktop);
  132. STDMETHODIMP SetVar(int var, DWORD value);
  133. protected:
  134. CDeskTray(); // noone but tray should instantiate
  135. CTray* _ptray;
  136. friend class CTray;
  137. };
  138. EXTERN_C void Tray_OnStartMenuDismissed();
  139. #ifdef FEATURE_STARTPAGE
  140. EXTERN_C void Tray_OnStartPageDismissed();
  141. EXTERN_C void Tray_MenuInvoke(int idCmd);
  142. #endif
  143. EXTERN_C void Tray_SetStartPaneActive(BOOL fActive);
  144. EXTERN_C void Tray_UnlockStartPane();
  145. #define TPF_TASKBARPAGE 0x00000001
  146. #define TPF_STARTMENUPAGE 0x00000002
  147. #define TPF_INVOKECUSTOMIZE 0x00000004 // start with the "Customize..." sub-dialog open
  148. EXTERN_C void Tray_DoProperties(DWORD dwFlags);
  149. #define AH_OFF 0x00
  150. #define AH_ON 0x01
  151. #define AH_HIDING 0x02
  152. class CTray : public CImpWndProc
  153. {
  154. public:
  155. //
  156. // miscellaneous public methods
  157. //
  158. CTray();
  159. void HandleWindowDestroyed(HWND hwnd);
  160. void HandleFullScreenApp(HWND hwnd);
  161. void RealityCheck();
  162. DWORD getStuckPlace() { return _uStuckPlace; }
  163. void InvisibleUnhide(BOOL fShowWindow);
  164. void ContextMenuInvoke(int idCmd);
  165. HMENU BuildContextMenu(BOOL fIncludeTime);
  166. void AsyncSaveSettings();
  167. BOOL Init();
  168. void Unhide();
  169. void VerifySize(BOOL fWinIni, BOOL fRoundUp = FALSE);
  170. void SizeWindows();
  171. int HotkeyAdd(WORD wHotkey, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlItem, BOOL fClone);
  172. void CheckWindowPositions();
  173. void SaveWindowPositions(UINT idRes);
  174. void ForceStartButtonUp();
  175. void DoProperties(DWORD dwFlags);
  176. void LogFailedStartupApp();
  177. HWND GetTaskWindow() { return _hwndTasks; }
  178. HWND GetTrayTips() { return _hwndTrayTips; }
  179. IDeskTray* GetDeskTray() { return &_desktray; }
  180. IMenuPopup* GetStartMenu() { return _pmpStartMenu; };
  181. void StartMenuContextMenu(HWND hwnd, DWORD dwPos);
  182. BOOL IsTaskbarFading() { return _fTaskbarFading; };
  183. DWORD CountOfRunningPrograms();
  184. void ClosePopupMenus();
  185. HWND GetTrayNotifyHWND()
  186. {
  187. return _hwndNotify;
  188. }
  189. void CreateStartButtonBalloon(UINT idsTitle, UINT idsMessage);
  190. void GetTrayViewOpts(TRAYVIEWOPTS* ptvo)
  191. {
  192. ptvo->fAlwaysOnTop = _fAlwaysOnTop;
  193. ptvo->fSMSmallIcons = _fSMSmallIcons;
  194. ptvo->fHideClock = _fHideClock;
  195. ptvo->fNoTrayItemsDisplayPolicyEnabled = _trayNotify.GetIsNoTrayItemsDisplayPolicyEnabled();
  196. ptvo->fNoAutoTrayPolicyEnabled = _trayNotify.GetIsNoAutoTrayPolicyEnabled();
  197. ptvo->fAutoTrayEnabledByUser = _trayNotify.GetIsAutoTrayEnabledByUser();
  198. ptvo->uAutoHide = _uAutoHide; // AH_HIDING , AH_ON
  199. ptvo->fShowQuickLaunch = (-1 != SendMessage(_hwnd, WMTRAY_TOGGLEQL, 0, (LPARAM)-1));
  200. }
  201. void SetTrayViewOpts(const TRAYVIEWOPTS* ptvo)
  202. {
  203. _UpdateAlwaysOnTop(ptvo->fAlwaysOnTop);
  204. SendMessage(_hwnd, WMTRAY_TOGGLEQL, 0, (LPARAM)ptvo->fShowQuickLaunch);
  205. _fSMSmallIcons = ptvo->fSMSmallIcons;
  206. _fHideClock = ptvo->fHideClock;
  207. _uAutoHide = ptvo->uAutoHide; // AH_HIDING , AH_ON
  208. // There is no necessity to save the fNoAutoTrayPolicyEnabled,
  209. // fNoTrayItemsDisplayPolicyEnabled, fAutoTrayEnabledByUser settings...
  210. }
  211. BOOL GetIsNoToolbarsOnTaskbarPolicyEnabled() const
  212. {
  213. return _fNoToolbarsOnTaskbarPolicyEnabled;
  214. }
  215. STDMETHODIMP_(ULONG) AddRef() { return 2; }
  216. STDMETHODIMP_(ULONG) Release() { return 1; }
  217. //
  218. // miscellaneous public data
  219. //
  220. // from TRAYSTUFF
  221. BOOL _fCoolTaskbar;
  222. BOOL _bMainMenuInit;
  223. BOOL _fFlashing; // currently flashing (HSHELL_FLASH)
  224. BOOL _fStuckRudeApp;
  225. BOOL _fDeferedPosRectChange;
  226. BOOL _fSelfSizing;
  227. BOOL _fBalloonUp; // true if balloon notification is up
  228. BOOL _fIgnoreDoneMoving;
  229. BOOL _fShowSizingBarAlways;
  230. BOOL _fSkipErase;
  231. BOOL _fIsLogoff;
  232. BOOL _fBandSiteInitialized;
  233. HWND _hwndStart;
  234. HWND _hwndLastActive;
  235. IBandSite *_ptbs;
  236. UINT _uAutoHide; // AH_HIDING , AH_ON
  237. HBITMAP _hbmpStartBkg;
  238. HFONT _hFontStart;
  239. RECT _arStuckRects[4]; // temporary for hit-testing
  240. CTrayNotify _trayNotify;
  241. protected:
  242. // protected methods
  243. friend class CTaskBarPropertySheet;
  244. static DWORD WINAPI SyncThreadProc(void *pv);
  245. DWORD _SyncThreadProc();
  246. static DWORD WINAPI MainThreadProc(void *pv);
  247. int _GetPart(BOOL fSizingBar, UINT uStuckPlace);
  248. void _UpdateVertical(UINT uStuckPlace, BOOL fForce = FALSE);
  249. void _RaiseDesktop(BOOL fRaise, BOOL fRestoreWindows);
  250. BOOL _RestoreWindowPositions(BOOL fPostLowerDesktop);
  251. void _RestoreWindowPos();
  252. static BOOL SavePosEnumProc(HWND hwnd, LPARAM lParam);
  253. BOOL _IsPopupMenuVisible();
  254. BOOL _IsActive();
  255. void _AlignStartButton();
  256. void _GetWindowSizes(UINT uStuckPlace, PRECT prcClient, PRECT prcView, PRECT prcNotify);
  257. void _GetStuckDisplayRect(UINT uStuckPlace, LPRECT prcDisplay);
  258. void _Hide();
  259. HWND _GetClockWindow(void);
  260. HRESULT _LoadInProc(PCOPYDATASTRUCT pcds);
  261. LRESULT _CreateWindows();
  262. LRESULT _InitStartButtonEtc();
  263. void _AdjustMinimizedMetrics();
  264. void _MessageLoop();
  265. void _BuildStartMenu();
  266. void _DestroyStartMenu();
  267. int _TrackMenu(HMENU hmenu);
  268. static DWORD WINAPI RunDlgThreadProc(void *pv);
  269. DWORD _RunDlgThreadProc(HANDLE hdata);
  270. int _GetQuickLaunchID();
  271. int _ToggleQL(int iVisible);
  272. static BOOL TileEnumProc(HWND hwnd, LPARAM lParam);
  273. BOOL _CanTileAnyWindows()
  274. {
  275. return !EnumWindows(TileEnumProc, (LPARAM)this);
  276. }
  277. void _RegisterDropTargets();
  278. void _RevokeDropTargets();
  279. BOOL _UpdateAlwaysOnTop(BOOL fAlwaysOnTop);
  280. HMONITOR _GetDisplayRectFromRect(LPRECT prcDisplay, LPCRECT prcIn, UINT uFlags);
  281. HMONITOR _GetDisplayRectFromPoint(LPRECT prcDisplay, POINT pt, UINT uFlags);
  282. void _AdjustRectForSizingBar(UINT uStuckPlace, LPRECT prc, int iIncrement);
  283. void _MakeStuckRect(LPRECT prcStick, LPCRECT prcBound, SIZE size, UINT uStick);
  284. void _ScreenSizeChange(HWND hwnd);
  285. void _ContextMenu(DWORD dwPos, BOOL fSetTime);
  286. void _StuckTrayChange();
  287. void _ResetZorder();
  288. void _HandleSize();
  289. BOOL _HandleSizing(WPARAM code, LPRECT lprc, UINT uStuckPlace);
  290. void _RegisterGlobalHotkeys();
  291. void _UnregisterGlobalHotkeys();
  292. void _HandleGlobalHotkey(WPARAM wParam);
  293. void _SetAutoHideTimer();
  294. void _ComputeHiddenRect(LPRECT prc, UINT uStuck);
  295. UINT _GetDockedRect(LPRECT prc, BOOL fMoving);
  296. void _CalcClipCoords(RECT *prcClip, const RECT *prcMonitor, const RECT *prcNew);
  297. void _ClipInternal(const RECT *prcClip);
  298. void _ClipWindow(BOOL fEnableClipping);
  299. UINT _CalcDragPlace(POINT pt);
  300. UINT _RecalcStuckPos(LPRECT prc);
  301. void _AutoHideCollision();
  302. LRESULT _HandleMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmi);
  303. void _OnDesktopState(LPARAM lParam);
  304. BOOL _ToggleLanguageBand(BOOL fShowIt);
  305. LRESULT _OnDeviceChange(HWND hwnd, WPARAM wParam, LPARAM lParam);
  306. DWORD _PtOnResizableEdge(POINT pt, LPRECT prcClient);
  307. BOOL _MapNCToClient(LPARAM* plParam);
  308. BOOL _TryForwardNCToClient(UINT uMsg, LPARAM lParam);
  309. LRESULT _OnSessionChange(WPARAM wParam, LPARAM lParam);
  310. LRESULT _NCPaint(HRGN hrgn);
  311. LRESULT v_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  312. BOOL _CanMinimizeAll();
  313. BOOL _MinimizeAll(BOOL fPostRaiseDesktop);
  314. void _Command(UINT idCmd);
  315. LONG _SetAutoHideState(BOOL fAutoHide);
  316. BOOL _ShouldWeShowTheStartButtonBalloon();
  317. void _DontShowTheStartButtonBalloonAnyMore();
  318. void _DestroyStartButtonBalloon();
  319. void _ShowStartButtonToolTip();
  320. void _ToolbarMenu();
  321. HFONT _CreateStartFont(HWND hwndTray);
  322. void _SaveTrayStuff(void);
  323. void _SaveTray(void);
  324. void _SaveTrayAndDesktop(void);
  325. void _SlideStep(HWND hwnd, const RECT *prcMonitor, const RECT *prcOld, const RECT *prcNew);
  326. void _DoExitWindows(HWND hwnd);
  327. static LRESULT WINAPI StartButtonSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  328. LRESULT _StartButtonSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  329. void _ResizeStuckRects(RECT *arStuckRects);
  330. static DWORD WINAPI PropertiesThreadProc(void* pv);
  331. DWORD _PropertiesThreadProc(DWORD dwFlags);
  332. int _RecomputeWorkArea(HWND hwndCause, HMONITOR hmon, LPRECT prcWork);
  333. void _StartButtonReset();
  334. void _RefreshStartMenu();
  335. void _ExploreCommonStartMenu(BOOL bExplore);
  336. BOOL _CreateClockWindow();
  337. void _CreateTrayTips();
  338. HWND _CreateStartButton();
  339. BOOL _InitTrayClass();
  340. void _SetStuckMonitor();
  341. void _GetSaveStateAndInitRects();
  342. LRESULT _OnCreateAsync();
  343. LRESULT _OnCreate(HWND hwnd);
  344. void _UpdateBandSiteStyle();
  345. void _InitBandsite();
  346. void _InitNonzeroGlobals();
  347. void _CreateTrayWindow();
  348. void _DoneMoving(LPWINDOWPOS lpwp);
  349. void _SnapshotStuckRectSize(UINT uPlace);
  350. void _RecomputeAllWorkareas();
  351. void _SlideWindow(HWND hwnd, RECT *prc, BOOL fShow);
  352. void _UnhideNow();
  353. void _HandleEnterMenuLoop();
  354. void _HandleExitMenuLoop();
  355. void _SetUnhideTimer(LONG x, LONG y);
  356. void _OnNewSystemSizes();
  357. static int WINAPI CheckWndPosEnumProc(void *pItem, void *pData);
  358. void _HandleTimer(WPARAM wTimerID);
  359. void _KickStartAutohide();
  360. void _HandleMoving(WPARAM wParam, LPRECT lprc);
  361. LRESULT _HandleDestroy();
  362. void _SetFocus(HWND hwnd);
  363. void _ActAsSwitcher();
  364. void _OnWinIniChange(HWND hwnd, WPARAM wParam, LPARAM lParam);
  365. LRESULT _ShortcutRegisterHotkey(HWND hwnd, WORD wHotkey, ATOM atom);
  366. LRESULT _SetHotkeyEnable(HWND hwnd, BOOL fEnable);
  367. void _HandleWindowPosChanging(LPWINDOWPOS lpwp);
  368. void _HandlePowerStatus(UINT uMsg, WPARAM wParam, LPARAM lParam);
  369. void _DesktopCleanup_GetFileTimeNDaysFromGivenTime(const FILETIME *pftGiven, FILETIME * pftReturn, int iDays);
  370. BOOL _DesktopCleanup_ShouldRun();
  371. void _CheckDesktopCleanup(void);
  372. static BOOL_PTR WINAPI RogueProgramFileDlgProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam);
  373. void _CheckForRogueProgramFile();
  374. void _OnWaitCursorNotify(LPNMHDR pnm);
  375. void _HandlePrivateCommand(LPARAM lParam);
  376. void _OnFocusMsg(UINT uMsg, WPARAM wParam, LPARAM lParam);
  377. int _OnFactoryMessage(WPARAM wParam, LPARAM lParam);
  378. int _OnTimerService(UINT uMsg, WPARAM wParam, LPARAM lParam);
  379. void _HandleDelayBootStuff();
  380. void _HandleChangeNotify(WPARAM wParam, LPARAM lParam);
  381. void _CheckStagingAreaOnTimer();
  382. BOOL _IsTopmost();
  383. void _RefreshSettings();
  384. static BOOL PropagateEnumProc(HWND hwnd, LPARAM lParam);
  385. void _PropagateMessage(HWND hwnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
  386. BOOL _IsAutoHide() { return _uAutoHide & AH_ON; }
  387. void _RunDlg();
  388. static void WINAPI SettingsUIPropSheetCallback(DWORD nStartPage);
  389. static DWORD WINAPI SettingsUIThreadProc(void *pv);
  390. static BOOL WINAPI FullScreenEnumProc(HMONITOR hmon, HDC hdc, LPRECT prc, LPARAM dwData);
  391. static BOOL WINAPI MonitorEnumProc(HMONITOR hMonitor, HDC hdc, LPRECT lprc, LPARAM lData);
  392. // appbar stuff
  393. HRESULT _AppBarSetState(UINT uFlags);
  394. void _AppBarActivationChange(PTRAYAPPBARDATA ptabd);
  395. BOOL _AppBarSetAutoHideBar(PTRAYAPPBARDATA ptabd);
  396. BOOL _AppBarSetAutoHideBar2(HWND hwnd, BOOL fAutoHide, UINT uEdge);
  397. void _AppBarActivationChange2(HWND hwnd, UINT uEdge);
  398. HWND _AppBarGetAutoHideBar(UINT uEdge);
  399. LRESULT _OnAppBarMessage(PCOPYDATASTRUCT pcds);
  400. void _AppBarSubtractRect(PAPPBAR pab, LPRECT lprc);
  401. void _AppBarSubtractRects(HMONITOR hmon, LPRECT lprc);
  402. void _StuckAppChange(HWND hwndCause, LPCRECT prcOld, LPCRECT prcNew, BOOL bTray);
  403. void _AppBarNotifyAll(HMONITOR hmon, UINT uMsg, HWND hwndExclude, LPARAM lParam);
  404. void _AppBarGetTaskBarPos(PTRAYAPPBARDATA ptabd);
  405. void _NukeAppBar(int i);
  406. void _AppBarRemove(PTRAYAPPBARDATA ptabd);
  407. PAPPBAR _FindAppBar(HWND hwnd);
  408. BOOL _AppBarNew(PTRAYAPPBARDATA ptabd);
  409. BOOL _AppBarOutsideOf(PAPPBAR pabReq, PAPPBAR pab);
  410. void _AppBarQueryPos(PTRAYAPPBARDATA ptabd);
  411. void _AppBarSetPos(PTRAYAPPBARDATA ptabd);
  412. // hotkey stuff
  413. void _HandleHotKey(int nID);
  414. LRESULT _ShortcutUnregisterHotkey(HWND hwnd, WORD wHotkey);
  415. LRESULT _RegisterHotkey(HWND hwnd, int i);
  416. LRESULT _UnregisterHotkey(HWND hwnd, int i);
  417. HWND _HotkeyInUse(WORD wHK);
  418. int _RestoreHotkeyList(HWND hwnd);
  419. UINT _HotkeyGetFreeItemIndex(void);
  420. int _HotkeyAddCached(WORD wGHotkey, LPITEMIDLIST pidl);
  421. int _HotkeySave(void);
  422. int _HotkeyRemove(WORD wHotkey);
  423. int _HotkeyRemoveCached(WORD wGHotkey);
  424. BOOL _HotkeyCreate(void);
  425. // Startup troubleshooter stuff
  426. static void WINAPI TroubleShootStartupCB(HWND hwnd, UINT uMsg, UINT_PTR idTimer, DWORD dwTime);
  427. void _OnHandleStartupFailed();
  428. // App compat stuff
  429. static void CALLBACK _MigrateOldBrowserSettingsCB(PVOID lpParameter, BOOLEAN);
  430. void _MigrateOldBrowserSettings();
  431. // protected data
  432. HWND _hwndNotify; // clock window
  433. HWND _hwndStartBalloon;
  434. HWND _hwndRude;
  435. HWND _hwndTrayTips;
  436. HWND _hwndTasks;
  437. HMENU _hmenuStart;
  438. SIZE _sizeStart; // height/width of the start button
  439. SIZE _sizeSizingBar;
  440. int _iAlpha;
  441. HIMAGELIST _himlStartFlag;
  442. CShellServiceObjectMgr _ssomgr;
  443. CStartDropTarget _dtStart;
  444. CTrayDropTarget _dtTray;
  445. CDeskTray _desktray;
  446. #define MM_OTHER 0x01
  447. #define MM_SHUTDOWN 0x02
  448. UINT _uModalMode;
  449. BOOL _fAlwaysOnTop;
  450. BOOL _fSMSmallIcons;
  451. BOOL _fGlobalHotkeyDisable;
  452. BOOL _fThreadTerminate;
  453. BOOL _fSysSizing; // being sized by user; hold off on recalc
  454. BOOL _fHideClock;
  455. BOOL _fShouldResize;
  456. BOOL _fMonitorClipped;
  457. BOOL _fHandledDelayBootStuff;
  458. BOOL _fUndoEnabled;
  459. BOOL _fProcessingDesktopRaise;
  460. BOOL _fFromStart; // Track when context menu popping up from Start button
  461. BOOL _fTaskbarFading;
  462. BOOL _fNoToolbarsOnTaskbarPolicyEnabled;
  463. BOOL _fForegroundLocked;
  464. POINT _ptLastHittest;
  465. HWND _hwndRun;
  466. HWND _hwndProp;
  467. HWND _hwndRebar;
  468. HACCEL _hMainAccel; // Main accel table
  469. int _iWaitCount;
  470. HDPA _hdpaAppBars; // app bar info
  471. HDSA _hdsaHKI; // hotkey info
  472. CRITICAL_SECTION _csHotkey; // Protects _hdsaHKI, hotkey info
  473. LPWINDOWPOSITIONS _pPositions; // saved windows positions (for undo of minimize all)
  474. UINT _uStuckPlace; // the stuck place
  475. SIZE _sStuckWidths; // width/height of tray
  476. UINT _uMoveStuckPlace; // stuck status during a move operation
  477. // these two must go together for save reasons
  478. RECT _rcOldTray; // last place we stuck ourselves (for work area diffs)
  479. HMONITOR _hmonStuck; // The current HMONITOR we are on
  480. HMONITOR _hmonOld; // The last hMonitor we were on
  481. IMenuBand* _pmbStartMenu; //For Message translation.
  482. IMenuPopup* _pmpStartMenu; //For start menu cache
  483. IMenuBand* _pmbStartPane; // For Message translation.
  484. IMenuPopup* _pmpStartPane; // For navigating the start pane
  485. void * _pvStartPane; // For delayed initilization
  486. IStartMenuPin *_psmpin; // For drag/drop to Start Button
  487. IMenuBand* _pmbTasks; //For Message translation.
  488. IMenuPopup* _pmpTasks;
  489. IDeskBand* _pdbTasks;
  490. WNDPROC _pfnButtonProc; // Button subclass.
  491. UINT _uDown;
  492. BOOL _fAllowUp; // Is the start button allowed to be in the up position?
  493. UINT _uStartButtonState; // crazy state machine -- see Tray_SetStartPaneActive
  494. DWORD _tmOpen; // time the Start Menu was opened (for debouncing)
  495. int _cHided;
  496. int _cyTrayBorders;
  497. HTHEME _hTheme;
  498. //
  499. // amount of time to show/hide the tray
  500. // to turn sliding off set these to 0
  501. //
  502. int _dtSlideHide;
  503. int _dtSlideShow;
  504. HWND _hwndFocusBeforeRaise;
  505. BOOL _fMinimizedAllBeforeRaise;
  506. BOOL _fCanSizeMove; // can be turned off by user setting
  507. RECT _rcSizeMoveIgnore;
  508. // event to tell the services on NT5 that we are done with boot
  509. // and they can do their stuff
  510. HANDLE _hShellReadyEvent;
  511. // BOGUS: nuke this (multiple monitors...)
  512. HWND _aHwndAutoHide[ABE_MAX];
  513. // Users and Passwords must send this message to get the "real" logged on user to log off.
  514. // This is required since sometimes U&P runs in the context of a different user and logging this
  515. // other user off does no good. See ext\netplwiz for the other half of this...-dsheldon.
  516. UINT _uLogoffUser;
  517. UINT _uStartButtonBalloonTip;
  518. UINT _uWinMM_DeviceChange;
  519. BOOL _fEarlyStartupFailure;
  520. BOOL _fStartupTroubleshooterLaunched;
  521. ULONG _uNotify;
  522. BOOL _fUseChangeNotifyTimer, _fChangeNotifyTimerRunning;
  523. BOOL _fIsDesktopLocked;
  524. BOOL _fIsDesktopConnected;
  525. // These member variables are used to keep track of downlevel apps
  526. // which attempt to take over as default web browser
  527. HKEY _hkHTTP;
  528. HANDLE _hHTTPEvent;
  529. HANDLE _hHTTPWait;
  530. friend class CDeskTray;
  531. friend class CStartDropTarget;
  532. friend class CTrayDropTarget;
  533. friend class CDropTargetBase;
  534. friend void Tray_OnStartMenuDismissed();
  535. #ifdef FEATURE_STARTPAGE
  536. friend void Tray_OnStartPageDismissed();
  537. #endif
  538. friend void Tray_SetStartPaneActive(BOOL fActive);
  539. friend void Tray_UnlockStartPane();
  540. friend void Tray_DoProperties(DWORD dwFlags);
  541. };
  542. extern CTray c_tray;
  543. extern BOOL g_fInSizeMove;
  544. extern UINT g_uStartButtonAllowPopup;
  545. BOOL _IsSizeMoveEnabled();
  546. BOOL _IsSizeMoveRestricted();
  547. #endif // __cplusplus
  548. #endif // _TRAY_H