ReactOS  0.4.15-dev-5109-g2469ce2
traywnd.cpp
Go to the documentation of this file.
1 /*
2  * ReactOS Explorer
3  *
4  * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5  * Copyright 2018-2022 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  *
7  * this library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * this library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "precomp.h"
23 #include <commoncontrols.h>
24 
25 HRESULT TrayWindowCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu);
27 void appbar_notify_all(HMONITOR hMon, UINT uMsg, HWND hwndExclude, LPARAM lParam);
28 
29 #define WM_APP_TRAYDESTROY (WM_APP + 0x100)
30 
31 #define TIMER_ID_AUTOHIDE 1
32 #define TIMER_ID_MOUSETRACK 2
33 #define MOUSETRACK_INTERVAL 100
34 #define AUTOHIDE_DELAY_HIDE 2000
35 #define AUTOHIDE_DELAY_SHOW 50
36 #define AUTOHIDE_INTERVAL_ANIMATING 10
37 
38 #define AUTOHIDE_SPEED_SHOW 10
39 #define AUTOHIDE_SPEED_HIDE 1
40 
41 #define AUTOHIDE_HIDDEN 0
42 #define AUTOHIDE_SHOWING 1
43 #define AUTOHIDE_SHOWN 2
44 #define AUTOHIDE_HIDING 3
45 
46 #define IDHK_RUN 0x1f4
47 #define IDHK_MINIMIZE_ALL 0x1f5
48 #define IDHK_RESTORE_ALL 0x1f6
49 #define IDHK_HELP 0x1f7
50 #define IDHK_EXPLORE 0x1f8
51 #define IDHK_FIND 0x1f9
52 #define IDHK_FIND_COMPUTER 0x1fa
53 #define IDHK_NEXT_TASK 0x1fb
54 #define IDHK_PREV_TASK 0x1fc
55 #define IDHK_SYS_PROPERTIES 0x1fd
56 #define IDHK_DESKTOP 0x1fe
57 #define IDHK_PAGER 0x1ff
58 
59 static const WCHAR szTrayWndClass[] = L"Shell_TrayWnd";
60 
62 {
68 };
69 
70 static BOOL CALLBACK
72 {
74 
76  return TRUE; // continue
77 
78  if (pei->hTrayWnd == hwnd || pei->hwndDesktop == hwnd ||
79  pei->hwndProgman == hwnd)
80  {
81  return TRUE; // continue
82  }
83 
84  if (pei->bMustBeInMonitor)
85  {
86  // is the window in the nearest monitor?
87  HMONITOR hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
88  if (hMon)
89  {
91  ZeroMemory(&info, sizeof(info));
92  info.cbSize = sizeof(info);
93  if (GetMonitorInfoW(hMon, &info))
94  {
95  RECT rcWindow, rcMonitor, rcIntersect;
96  rcMonitor = info.rcMonitor;
97 
98  GetWindowRect(hwnd, &rcWindow);
99 
100  if (!IntersectRect(&rcIntersect, &rcMonitor, &rcWindow))
101  return TRUE; // continue
102  }
103  }
104  }
105 
106  pei->hwndFound = hwnd;
107  return FALSE; // stop if found
108 }
109 
110 static BOOL
112 {
113  EFFECTIVE_INFO ei;
114  ei.hwndFound = NULL;
116  ei.hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
117  ei.hwndProgman = FindWindowW(L"Progman", NULL);
118  ei.bMustBeInMonitor = bMustBeInMonitor;
119 
121  if (ei.hwndFound && FALSE)
122  {
123  WCHAR szClass[64], szText[64];
124  GetClassNameW(ei.hwndFound, szClass, _countof(szClass));
125  GetWindowTextW(ei.hwndFound, szText, _countof(szText));
126  MessageBoxW(NULL, szText, szClass, 0);
127  }
128  return ei.hwndFound != NULL;
129 }
130 
132 
133 /*
134  * ITrayWindow
135  */
136 
137 const GUID IID_IShellDesktopTray = { 0x213e2df9, 0x9a14, 0x4328, { 0x99, 0xb1, 0x69, 0x61, 0xf9, 0x14, 0x3c, 0xe9 } };
138 
140  : public CWindowImpl<CStartButton>
141 {
145 
146 public:
148  : m_ImageList(NULL),
149  m_Font(NULL)
150  {
151  m_Size.cx = 0;
152  m_Size.cy = 0;
153  }
154 
155  virtual ~CStartButton()
156  {
157  if (m_ImageList != NULL)
159 
160  if (m_Font != NULL)
162  }
163 
165  {
166  return m_Size;
167  }
168 
170  {
171  SIZE Size = { 0, 0 };
172 
173  if (m_ImageList == NULL ||
175  {
177  }
178 
180 
181  /* Save the size of the start button */
182  m_Size = Size;
183  }
184 
186  {
187  /* Get the system fonts, we use the caption font, always bold, though. */
188  NONCLIENTMETRICS ncm = {sizeof(ncm)};
189  if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
190  return;
191 
192  if (m_Font)
194 
195  ncm.lfCaptionFont.lfWeight = FW_BOLD;
196  m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
197 
198  SetFont(m_Font, FALSE);
199  }
200 
202  {
203  // HACK & FIXME: CORE-18016
204  HWND hWnd = m_hWnd;
205  m_hWnd = NULL;
207 
208  SetWindowTheme(m_hWnd, L"Start", NULL);
209 
212  0, 0, 0,
213  IMAGE_BITMAP,
215 
218  UpdateSize();
219  }
220 
222  {
223  WCHAR szStartCaption[32];
225  IDS_START,
226  szStartCaption,
227  _countof(szStartCaption)))
228  {
229  wcscpy(szStartCaption, L"Start");
230  }
231 
233 
234  // HACK & FIXME: CORE-18016
236  0,
237  WC_BUTTON,
238  szStartCaption,
239  dwStyle,
240  0, 0, 0, 0,
241  hwndParent,
244  NULL);
245 
246  if (m_hWnd)
247  Initialize();
248 
249  return m_hWnd;
250  }
251 
253  {
254  if (uMsg == WM_KEYUP && wParam != VK_SPACE)
255  return 0;
256 
258  return 0;
259  }
260 
263  END_MSG_MAP()
264 
265 };
266 
267 // This window class name is CONFIRMED on Win10 by WinHier.
268 static const WCHAR szTrayShowDesktopButton[] = L"TrayShowDesktopButtonWClass";
269 
270 // The 'Show Desktop' button at edge of taskbar
272  public CWindowImpl<CTrayShowDesktopButton, CWindow, CControlWinTraits>
273 {
277 
278 public:
280 
282  {
283  }
284 
286  {
287 #define SHOW_DESKTOP_MINIMUM_WIDTH 3
288  INT cxy = 2 * ::GetSystemMetrics(SM_CXEDGE);
289  return max(cxy, SHOW_DESKTOP_MINIMUM_WIDTH);
290  }
291 
293  {
296  if (!m_hWnd)
297  return E_FAIL;
298 
299  ::SetWindowTheme(m_hWnd, L"TaskBar", NULL);
300  return S_OK;
301  }
302 
304  {
305  // The actual action can be delayed as an expected behaviour.
306  // But a too late action is an unexpected behaviour.
307  LONG nTime0 = m_nClickedTime;
308  LONG nTime1 = ::GetMessageTime();
309  if (nTime1 - nTime0 >= 600) // Ignore after 0.6 sec
310  return 0;
311 
312  // Show/Hide Desktop
314  return 0;
315  }
316 
317 #define TSDB_CLICK (WM_USER + 100)
318 
319  // This function is called from OnLButtonDown and parent.
321  {
322  // The actual action can be delayed as an expected behaviour.
324  PostMessage(TSDB_CLICK, 0, 0);
325  }
326 
328  {
329  Click(); // Left-click
330  return 0;
331  }
332 
334  {
335  if (m_hTheme)
337 
338  m_hTheme = ::OpenThemeData(m_hWnd, L"TaskBar");
340  return 0;
341  }
342 
343  // This function is called from OnPaint and parent.
345 
347  {
348  RECT rc;
349  GetClientRect(&rc);
350 
351  PAINTSTRUCT ps;
352  HDC hdc = BeginPaint(&ps);
353  OnDraw(hdc, &rc);
354  EndPaint(&ps);
355  return 0;
356  }
357 
359  {
360  if (!IsWindow())
361  return FALSE;
362  RECT rc;
363  GetWindowRect(&rc);
365  ::InflateRect(&rc, max(cxEdge, 1), max(cyEdge, 1));
366  return ::PtInRect(&rc, pt);
367  }
368 
369 #define SHOW_DESKTOP_TIMER_ID 999
370 #define SHOW_DESKTOP_TIMER_INTERVAL 200
371 
373  {
374  if (m_bHovering)
375  return;
376 
377  m_bHovering = TRUE;
381  }
382 
384  {
385  StartHovering();
386  return 0;
387  }
388 
390  {
392  return 0;
393 
394  POINT pt;
395  ::GetCursorPos(&pt);
396  if (!PtInButton(pt)) // The end of hovering?
397  {
398  m_bHovering = FALSE;
402  }
403 
404  return 0;
405  }
406 
408  {
409  if (m_hTheme)
410  {
412  m_hTheme = NULL;
413  }
414  return 0;
415  }
416 
420  MESSAGE_HANDLER(WM_THEMECHANGED, OnSettingChanged)
426  END_MSG_MAP()
427 };
428 
430 {
431  if (m_hTheme)
432  {
433  if (m_bHovering) // Draw a hot button
434  {
435  HTHEME hButtonTheme = ::OpenThemeData(m_hWnd, L"Button");
437  ::CloseThemeData(hButtonTheme);
438  }
439  else // Draw a taskbar background
440  {
442  }
443  }
444  else
445  {
446  RECT rc = *prc;
447  if (m_bHovering) // Draw a hot button
448  {
450  HBRUSH hbrHot = ::CreateSolidBrush(RGB(255, 255, 191));
451  ::FillRect(hdc, &rc, hbrHot);
452  ::DeleteObject(hbrHot);
453  }
454  else // Draw a flattish button
455  {
457  ::InflateRect(&rc, -1, -1);
459  }
460  }
461 }
462 
463 class CTrayWindow :
464  public CComCoClass<CTrayWindow>,
465  public CComObjectRootEx<CComMultiThreadModelNoCS>,
466  public CWindowImpl < CTrayWindow, CWindow, CControlWinTraits >,
467  public ITrayWindow,
468  public IShellDesktopTray,
469  public IOleWindow,
470  public IContextMenu
471 {
474 
477 
481 
483 
488 
490 
496 
499 
502 
506 
508 
509 public:
511 
512  union
513  {
515  struct
516  {
517  /* UI Status */
521  };
522  };
523 
524 public:
526  m_StartButton(),
528  m_Theme(NULL),
529  m_Font(NULL),
531  m_Rebar(NULL),
534  m_Position(0),
535  m_Monitor(NULL),
543  Flags(0)
544  {
546  ZeroMemory(&m_TraySize, sizeof(m_TraySize));
549  }
550 
551  virtual ~CTrayWindow()
552  {
553  if (m_ShellServices != NULL)
554  {
557  }
558 
559  if (m_Font != NULL)
560  {
562  m_Font = NULL;
563  }
564 
565  if (m_Theme)
566  {
568  m_Theme = NULL;
569  }
570 
571  PostQuitMessage(0);
572  }
573 
574 
575 
576 
577 
578  /**********************************************************
579  * ##### command handling #####
580  */
581 
583  {
584  WCHAR szCommand[256];
585  WCHAR *pszParameters;
586 
588  id,
589  szCommand,
590  _countof(szCommand)))
591  {
592  return E_FAIL;
593  }
594 
595  pszParameters = wcschr(szCommand, L'>');
596  if (pszParameters)
597  {
598  *pszParameters = 0;
599  pszParameters++;
600  }
601 
602  ShellExecuteW(m_hWnd, NULL, szCommand, pszParameters, NULL, SW_SHOWNORMAL);
603  return S_OK;
604  }
605 
607  {
608  /* Display the ReactOS Shutdown Dialog */
610 
611  /*
612  * If the user presses CTRL+ALT+SHIFT while exiting
613  * the shutdown dialog, exit the shell cleanly.
614  */
615  if ((GetKeyState(VK_CONTROL) & 0x8000) &&
616  (GetKeyState(VK_SHIFT) & 0x8000) &&
617  (GetKeyState(VK_MENU) & 0x8000))
618  {
619  PostMessage(WM_QUIT, 0, 0);
620  }
621  return 0;
622  }
623 
625  {
626  HWND hwnd;
627  RECT posRect;
628 
629  m_StartButton.GetWindowRect(&posRect);
630 
631  hwnd = CreateWindowEx(0,
632  WC_STATIC,
633  NULL,
635  posRect.left,
636  posRect.top,
637  posRect.right - posRect.left,
638  posRect.bottom - posRect.top,
639  NULL,
640  NULL,
641  NULL,
642  NULL);
643 
645 
646  // build the default directory from two environment variables
647  CStringW strDefaultDir, strHomePath;
648  strDefaultDir.GetEnvironmentVariable(L"HOMEDRIVE");
649  strHomePath.GetEnvironmentVariable(L"HOMEPATH");
650  strDefaultDir += strHomePath;
651 
652  RunFileDlg(hwnd, NULL, (LPCWSTR)strDefaultDir, NULL, NULL, RFF_CALCDIRECTORY);
653 
656 
657  return 0;
658  }
659 
661  {
662  CTrayWindow * This = (CTrayWindow*) pParam;
663  return This->RunFileDlgThread();
664  }
665 
667  {
668  HWND hRunDlg;
669  if (m_RunFileDlgOwner)
670  {
672  if (hRunDlg != NULL &&
673  hRunDlg != m_RunFileDlgOwner)
674  {
675  SetForegroundWindow(hRunDlg);
676  return;
677  }
678  }
679 
681  }
682 
684  {
685  HWND hwnd;
686  RECT posRect;
687 
688  m_StartButton.GetWindowRect(&posRect);
689  hwnd = CreateWindowEx(0,
690  WC_STATIC,
691  NULL,
693  posRect.left,
694  posRect.top,
695  posRect.right - posRect.left,
696  posRect.bottom - posRect.top,
697  NULL,
698  NULL,
699  NULL,
700  NULL);
701 
703 
705 
708 
709  return 0;
710  }
711 
713  {
714  CTrayWindow *This = (CTrayWindow*) pParam;
715 
716  return This->TrayPropertiesThread();
717  }
718 
720  {
721  HWND hTrayProp;
722 
724  {
726  if (hTrayProp != NULL &&
727  hTrayProp != m_TrayPropertiesOwner)
728  {
729  SetForegroundWindow(hTrayProp);
730  return NULL;
731  }
732  }
733 
735  return NULL;
736  }
737 
739  {
740  WCHAR szDir[MAX_PATH];
741 
742  if (SHGetSpecialFolderPath(hWndOwner,
743  szDir,
745  FALSE))
746  {
747  ShellExecute(hWndOwner,
748  lpOperation,
749  szDir,
750  NULL,
751  NULL,
752  SW_SHOWNORMAL);
753  }
754  }
755 
757  {
758  ShellExecute(hWndOwner,
759  TEXT("open"),
760  TEXT("taskmgr.exe"),
761  NULL,
762  NULL,
763  SW_SHOWNORMAL);
764  }
765 
767  {
769  {
770  ShowDesktop();
771  }
772  else
773  {
774  RestoreAll();
775  }
776  }
777 
779  {
780  switch (uiCmd)
781  {
784  break;
785 
788  TEXT("open"));
789  break;
790 
793  TEXT("explore"));
794  break;
795 
796  case ID_LOCKTASKBAR:
798  {
800  }
801  break;
802 
805  break;
806 
808  break;
809 
811  ShowDesktop();
812  break;
813 
818  break;
819 
824  break;
825 
830  break;
831 
834  break;
835 
837  //FIXME: Use SHRunControlPanel
838  ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
839  break;
840 
842  RestoreAll();
843  break;
844 
845  default:
846  TRACE("ITrayWindow::ExecContextMenuCmd(%u): Unhandled Command ID!\n", uiCmd);
847  return FALSE;
848  }
849 
850  return TRUE;
851  }
852 
854  {
855  switch (id)
856  {
857  case IDHK_RUN:
859  break;
860  case IDHK_HELP:
862  break;
863  case IDHK_EXPLORE:
864  //FIXME: We don't support this yet:
865  //ShellExecuteW(0, L"explore", NULL, NULL, NULL, 1);
866  ShellExecuteW(0, NULL, L"explorer.exe", L"/e ,", NULL, 1);
867  break;
868  case IDHK_FIND:
870  break;
871  case IDHK_FIND_COMPUTER:
873  break;
874  case IDHK_SYS_PROPERTIES:
875  //FIXME: Use SHRunControlPanel
876  ShellExecuteW(m_hWnd, NULL, L"sysdm.cpl", NULL, NULL, SW_NORMAL);
877  break;
878  case IDHK_NEXT_TASK:
879  break;
880  case IDHK_PREV_TASK:
881  break;
882  case IDHK_MINIMIZE_ALL:
883  MinimizeAll();
884  break;
885  case IDHK_RESTORE_ALL:
886  RestoreAll();
887  break;
888  case IDHK_DESKTOP:
889  ToggleDesktop();
890  break;
891  case IDHK_PAGER:
892  break;
893  }
894 
895  return 0;
896  }
897 
899  {
900  switch (uCommand)
901  {
902  case TRAYCMD_STARTMENU:
903  // TODO:
904  break;
905  case TRAYCMD_RUN_DIALOG:
907  break;
909  LogoffWindowsDialog(m_hWnd); // FIXME: Maybe handle it in a similar way as DoExitWindows?
910  break;
911  case TRAYCMD_CASCADE:
913  break;
914  case TRAYCMD_TILE_H:
916  break;
917  case TRAYCMD_TILE_V:
919  break;
921  ToggleDesktop();
922  break;
924  ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
925  break;
928  break;
930  MinimizeAll();
931  break;
932  case TRAYCMD_RESTORE_ALL:
933  RestoreAll();
934  break;
936  ShowDesktop();
937  break;
940  break;
942  break;
945  {
947  }
948  break;
951  break;
953  // TODO:
954  break;
956  DoExitWindows();
957  break;
959  // TODO:
960  break;
962  // TODO:
963  break;
965  // TODO:
966  break;
967  case IDM_SEARCH:
970  break;
973  break;
974 
975  default:
976  break;
977  }
978 
979  return FALSE;
980  }
981 
982 
984  IN HMENU hMenu,
985  IN POINT *ppt OPTIONAL,
986  IN HWND hwndExclude OPTIONAL,
987  IN BOOL TrackUp,
988  IN BOOL IsContextMenu)
989  {
990  TPMPARAMS tmp, *ptmp = NULL;
991  POINT pt;
992  UINT cmdId;
993  UINT fuFlags;
994 
995  if (hwndExclude != NULL)
996  {
997  /* Get the client rectangle and map it to screen coordinates */
998  if (::GetClientRect(hwndExclude,
999  &tmp.rcExclude) &&
1000  ::MapWindowPoints(hwndExclude,
1001  NULL,
1002  (LPPOINT) &tmp.rcExclude,
1003  2) != 0)
1004  {
1005  ptmp = &tmp;
1006  }
1007  }
1008 
1009  if (ppt == NULL)
1010  {
1011  if (ptmp == NULL &&
1012  GetClientRect(&tmp.rcExclude) &&
1014  NULL,
1015  (LPPOINT) &tmp.rcExclude,
1016  2) != 0)
1017  {
1018  ptmp = &tmp;
1019  }
1020 
1021  if (ptmp != NULL)
1022  {
1023  /* NOTE: TrackPopupMenuEx will eventually align the track position
1024  for us, no need to take care of it here as long as the
1025  coordinates are somewhere within the exclusion rectangle */
1026  pt.x = ptmp->rcExclude.left;
1027  pt.y = ptmp->rcExclude.top;
1028  }
1029  else
1030  pt.x = pt.y = 0;
1031  }
1032  else
1033  pt = *ppt;
1034 
1035  tmp.cbSize = sizeof(tmp);
1036 
1037  fuFlags = TPM_RETURNCMD | TPM_VERTICAL;
1038  fuFlags |= (TrackUp ? TPM_BOTTOMALIGN : TPM_TOPALIGN);
1039  if (IsContextMenu)
1040  fuFlags |= TPM_RIGHTBUTTON;
1041  else
1042  fuFlags |= (TrackUp ? TPM_VERNEGANIMATION : TPM_VERPOSANIMATION);
1043 
1044  cmdId = TrackPopupMenuEx(hMenu,
1045  fuFlags,
1046  pt.x,
1047  pt.y,
1048  m_hWnd,
1049  ptmp);
1050 
1051  return cmdId;
1052  }
1053 
1055  IN IContextMenu * contextMenu,
1056  IN POINT *ppt OPTIONAL,
1057  IN HWND hwndExclude OPTIONAL,
1058  IN BOOL TrackUp,
1060  {
1061  POINT pt;
1062  TPMPARAMS params;
1063  RECT rc;
1064  HRESULT hr;
1065  UINT uCommand;
1066  HMENU popup = CreatePopupMenu();
1067 
1068  if (popup == NULL)
1069  return E_FAIL;
1070 
1071  if (ppt)
1072  {
1073  pt = *ppt;
1074  }
1075  else
1076  {
1077  ::GetWindowRect(m_hWnd, &rc);
1078  pt.x = rc.left;
1079  pt.y = rc.top;
1080  }
1081 
1082  TRACE("Before Query\n");
1083  hr = contextMenu->QueryContextMenu(popup, 0, 0, UINT_MAX, CMF_NORMAL);
1084  if (FAILED_UNEXPECTEDLY(hr))
1085  {
1086  TRACE("Query failed\n");
1087  DestroyMenu(popup);
1088  return hr;
1089  }
1090 
1091  TRACE("Before Tracking\n");
1093  if (hwndExclude)
1094  {
1095  ::GetWindowRect(hwndExclude, &rc);
1096  ZeroMemory(&params, sizeof(params));
1097  params.cbSize = sizeof(params);
1098  params.rcExclude = rc;
1099  uCommand = ::TrackPopupMenuEx(popup, TPM_RETURNCMD, pt.x, pt.y, m_hWnd, &params);
1100  }
1101  else
1102  {
1103  uCommand = ::TrackPopupMenuEx(popup, TPM_RETURNCMD, pt.x, pt.y, m_hWnd, NULL);
1104  }
1105  ::PostMessage(m_hWnd, WM_NULL, 0, 0);
1106 
1107  if (uCommand != 0)
1108  {
1109  TRACE("Before InvokeCommand\n");
1110  CMINVOKECOMMANDINFO cmi = { 0 };
1111  cmi.cbSize = sizeof(cmi);
1112  cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1113  cmi.hwnd = m_hWnd;
1114  hr = contextMenu->InvokeCommand(&cmi);
1115  }
1116  else
1117  {
1118  TRACE("TrackPopupMenu failed. Code=%d, LastError=%d\n", uCommand, GetLastError());
1119  hr = S_FALSE;
1120  }
1121 
1122  DestroyMenu(popup);
1123  return hr;
1124  }
1125 
1126 
1127 
1128 
1129 
1130  /**********************************************************
1131  * ##### moving and sizing handling #####
1132  */
1133 
1135  {
1136  /* There is nothing to do if themes are enabled */
1137  if (m_Theme)
1138  return;
1139 
1141 
1142  NONCLIENTMETRICS ncm = {sizeof(ncm)};
1143  if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
1144  {
1145  ERR("SPI_GETNONCLIENTMETRICS failed\n");
1146  return;
1147  }
1148 
1149  if (m_Font != NULL)
1151 
1152  ncm.lfCaptionFont.lfWeight = FW_NORMAL;
1153  m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
1154  if (!m_Font)
1155  {
1156  ERR("CreateFontIndirect failed\n");
1157  return;
1158  }
1159 
1163  }
1164 
1166  IN OUT RECT *pRect,
1167  IN DWORD dwFlags)
1168  {
1169  MONITORINFO mi;
1170  HMONITOR hMon;
1171 
1172  mi.cbSize = sizeof(mi);
1173  hMon = MonitorFromRect(pRect, dwFlags);
1174  if (hMon != NULL &&
1175  GetMonitorInfo(hMon, &mi))
1176  {
1177  *pRect = mi.rcMonitor;
1178  }
1179  else
1180  {
1181  pRect->left = 0;
1182  pRect->top = 0;
1183  pRect->right = GetSystemMetrics(SM_CXSCREEN);
1184  pRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1185 
1186  hMon = NULL;
1187  }
1188 
1189  return hMon;
1190  }
1191 
1193  IN const RECT *pRect)
1194  {
1195  HMONITOR hMon;
1196 
1197  /* In case the monitor sizes or saved sizes differ a bit (probably
1198  not a lot, only so the tray window overlaps into another monitor
1199  now), minimize the risk that we determine a wrong monitor by
1200  using the center point of the tray window if we can't determine
1201  it using the rectangle. */
1202  hMon = MonitorFromRect(pRect, MONITOR_DEFAULTTONULL);
1203  if (hMon == NULL)
1204  {
1205  POINT pt;
1206 
1207  pt.x = pRect->left + ((pRect->right - pRect->left) / 2);
1208  pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2);
1209 
1210  /* be less error-prone, find the nearest monitor */
1211  hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
1212  }
1213 
1214  return hMon;
1215  }
1216 
1218  IN HMONITOR hMonitor,
1219  IN OUT RECT *pRect)
1220  {
1221  HMONITOR hMon = NULL;
1222 
1223  if (hMonitor != NULL)
1224  {
1225  MONITORINFO mi;
1226 
1227  mi.cbSize = sizeof(mi);
1228  if (!GetMonitorInfo(hMonitor, &mi))
1229  {
1230  /* Hm, the monitor is gone? Try to find a monitor where it
1231  could be located now */
1232  hMon = GetMonitorFromRect(pRect);
1233  if (hMon == NULL ||
1234  !GetMonitorInfo(hMon, &mi))
1235  {
1236  hMon = NULL;
1237  goto GetPrimaryRect;
1238  }
1239  }
1240 
1241  *pRect = mi.rcMonitor;
1242  }
1243  else
1244  {
1245 GetPrimaryRect:
1246  pRect->left = 0;
1247  pRect->top = 0;
1248  pRect->right = GetSystemMetrics(SM_CXSCREEN);
1249  pRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1250  }
1251 
1252  return hMon;
1253  }
1254 
1256  {
1258  SIZE size;
1259 
1260  if (pos > ABE_BOTTOM)
1261  pos = ABE_BOTTOM;
1262 
1263  HRESULT hr = GetThemePartSize(m_Theme, NULL, iSizerPart[pos], 0, NULL, TS_TRUE, &size);
1264  if (FAILED_UNEXPECTEDLY(hr))
1265  return;
1266 
1267  switch (pos)
1268  {
1269  case ABE_TOP:
1270  rc->bottom -= size.cy;
1271  break;
1272  case ABE_BOTTOM:
1273  rc->top += size.cy;
1274  break;
1275  case ABE_LEFT:
1276  rc->right -= size.cx;
1277  break;
1278  case ABE_RIGHT:
1279  rc->left += size.cx;
1280  break;
1281  }
1282  }
1283 
1285  IN const SIZE *pTraySize,
1286  IN OUT RECT *pRect)
1287  {
1288  switch (Position)
1289  {
1290  case ABE_LEFT:
1291  pRect->right = pRect->left + pTraySize->cx;
1292  break;
1293 
1294  case ABE_TOP:
1295  pRect->bottom = pRect->top + pTraySize->cy;
1296  break;
1297 
1298  case ABE_RIGHT:
1299  pRect->left = pRect->right - pTraySize->cx;
1300  break;
1301 
1302  case ABE_BOTTOM:
1303  default:
1304  pRect->top = pRect->bottom - pTraySize->cy;
1305  break;
1306  }
1307  }
1308 
1310  IN const RECT *pScreen,
1311  IN const SIZE *pTraySize OPTIONAL,
1312  OUT RECT *pRect)
1313  {
1314  if (pTraySize == NULL)
1315  pTraySize = &m_TraySize;
1316 
1317  *pRect = *pScreen;
1318 
1319  if(!m_Theme)
1320  {
1321  /* Move the border outside of the screen */
1322  InflateRect(pRect,
1325  }
1326 
1327  MakeTrayRectWithSize(Position, pTraySize, pRect);
1328  }
1329 
1331  {
1332  return m_Position == ABE_TOP || m_Position == ABE_BOTTOM;
1333  }
1334 
1336  IN DWORD Position,
1337  IN OUT RECT *pRect)
1338  {
1339  RECT rcScreen;
1340  //BOOL Horizontal;
1341  HMONITOR hMon;
1342  SIZE szMax, szWnd;
1343 
1344  //Horizontal = IsPosHorizontal();
1345 
1346  szWnd.cx = pRect->right - pRect->left;
1347  szWnd.cy = pRect->bottom - pRect->top;
1348 
1349  rcScreen = *pRect;
1350  hMon = GetScreenRectFromRect(
1351  &rcScreen,
1352  MONITOR_DEFAULTTONEAREST);
1353 
1354  /* Calculate the maximum size of the tray window and limit the window
1355  size to half of the screen's size. */
1356  szMax.cx = (rcScreen.right - rcScreen.left) / 2;
1357  szMax.cy = (rcScreen.bottom - rcScreen.top) / 2;
1358  if (szWnd.cx > szMax.cx)
1359  szWnd.cx = szMax.cx;
1360  if (szWnd.cy > szMax.cy)
1361  szWnd.cy = szMax.cy;
1362 
1363  /* FIXME - calculate */
1364 
1366  &rcScreen,
1367  &szWnd,
1368  pRect);
1369 
1370  return hMon;
1371  }
1372 
1373 #if 0
1374  VOID
1375  GetMinimumWindowSize(
1376  OUT RECT *pRect)
1377  {
1378  RECT rcMin = {0};
1379 
1380  AdjustWindowRectEx(&rcMin,
1382  GWL_STYLE),
1383  FALSE,
1385  GWL_EXSTYLE));
1386 
1387  *pRect = rcMin;
1388  }
1389 #endif
1390 
1391 
1393  IN POINT pt,
1394  OUT RECT *pRect,
1395  OUT HMONITOR *phMonitor)
1396  {
1397  HMONITOR hMon, hMonNew;
1398  DWORD PosH, PosV, Pos;
1399  SIZE DeltaPt, ScreenOffset;
1400  RECT rcScreen;
1401 
1402  rcScreen.left = 0;
1403  rcScreen.top = 0;
1404 
1405  /* Determine the screen rectangle */
1406  hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL);
1407  if (hMon != NULL)
1408  {
1409  MONITORINFO mi;
1410 
1411  mi.cbSize = sizeof(mi);
1412  if (!GetMonitorInfo(hMon, &mi))
1413  {
1414  hMon = NULL;
1415  goto GetPrimaryScreenRect;
1416  }
1417 
1418  /* make left top corner of the screen zero based to
1419  make calculations easier */
1420  pt.x -= mi.rcMonitor.left;
1421  pt.y -= mi.rcMonitor.top;
1422 
1423  ScreenOffset.cx = mi.rcMonitor.left;
1424  ScreenOffset.cy = mi.rcMonitor.top;
1425  rcScreen.right = mi.rcMonitor.right - mi.rcMonitor.left;
1426  rcScreen.bottom = mi.rcMonitor.bottom - mi.rcMonitor.top;
1427  }
1428  else
1429  {
1430 GetPrimaryScreenRect:
1431  ScreenOffset.cx = 0;
1432  ScreenOffset.cy = 0;
1433  rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
1434  rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
1435  }
1436 
1437  /* Calculate the nearest screen border */
1438  if (pt.x < rcScreen.right / 2)
1439  {
1440  DeltaPt.cx = pt.x;
1441  PosH = ABE_LEFT;
1442  }
1443  else
1444  {
1445  DeltaPt.cx = rcScreen.right - pt.x;
1446  PosH = ABE_RIGHT;
1447  }
1448 
1449  if (pt.y < rcScreen.bottom / 2)
1450  {
1451  DeltaPt.cy = pt.y;
1452  PosV = ABE_TOP;
1453  }
1454  else
1455  {
1456  DeltaPt.cy = rcScreen.bottom - pt.y;
1457  PosV = ABE_BOTTOM;
1458  }
1459 
1460  Pos = (DeltaPt.cx * rcScreen.bottom < DeltaPt.cy * rcScreen.right) ? PosH : PosV;
1461 
1462  /* Fix the screen origin to be relative to the primary monitor again */
1463  OffsetRect(&rcScreen,
1464  ScreenOffset.cx,
1465  ScreenOffset.cy);
1466 
1467  RECT rcPos = m_TrayRects[Pos];
1468 
1469  hMonNew = GetMonitorFromRect(&rcPos);
1470  if (hMon != hMonNew)
1471  {
1472  SIZE szTray;
1473 
1474  /* Recalculate the rectangle, we're dragging to another monitor.
1475  We don't need to recalculate the rect on single monitor systems. */
1476  szTray.cx = rcPos.right - rcPos.left;
1477  szTray.cy = rcPos.bottom - rcPos.top;
1478 
1479  GetTrayRectFromScreenRect(Pos, &rcScreen, &szTray, pRect);
1480  hMon = hMonNew;
1481  }
1482  else
1483  {
1484  /* The user is dragging the tray window on the same monitor. We don't need
1485  to recalculate the rectangle */
1486  *pRect = rcPos;
1487  }
1488 
1489  *phMonitor = hMon;
1490 
1491  return Pos;
1492  }
1493 
1495  IN OUT RECT *pRect,
1496  OUT HMONITOR *phMonitor)
1497  {
1498  POINT pt;
1499 
1500  /* Calculate the center of the rectangle. We call
1501  GetDraggingRectFromPt to calculate a valid
1502  dragging rectangle */
1503  pt.x = pRect->left + ((pRect->right - pRect->left) / 2);
1504  pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2);
1505 
1506  return GetDraggingRectFromPt(
1507  pt,
1508  pRect,
1509  phMonitor);
1510  }
1511 
1513  {
1514  RECT rcTray;
1515 
1516  if (IsDragging)
1517  {
1518  rcTray.left = pwp->x;
1519  rcTray.top = pwp->y;
1520  rcTray.right = rcTray.left + pwp->cx;
1521  rcTray.bottom = rcTray.top + pwp->cy;
1522 
1523  if (!EqualRect(&rcTray,
1525  {
1526  /* Recalculate the rectangle, the user dragged the tray
1527  window to another monitor or the window was somehow else
1528  moved or resized */
1530  &rcTray,
1532  //m_TrayRects[DraggingPosition] = rcTray;
1533  }
1534 
1535  //Monitor = CalculateValidSize(DraggingPosition,
1536  // &rcTray);
1537 
1540  IsDragging = FALSE;
1541 
1542  m_TrayRects[m_Position] = rcTray;
1543  goto ChangePos;
1544  }
1545  else if (GetWindowRect(&rcTray))
1546  {
1547  if (InSizeMove)
1548  {
1549  if (!(pwp->flags & SWP_NOMOVE))
1550  {
1551  rcTray.left = pwp->x;
1552  rcTray.top = pwp->y;
1553  }
1554 
1555  if (!(pwp->flags & SWP_NOSIZE))
1556  {
1557  rcTray.right = rcTray.left + pwp->cx;
1558  rcTray.bottom = rcTray.top + pwp->cy;
1559  }
1560 
1562 
1563  if (!(pwp->flags & (SWP_NOMOVE | SWP_NOSIZE)))
1564  {
1565  SIZE szWnd;
1566 
1567  szWnd.cx = pwp->cx;
1568  szWnd.cy = pwp->cy;
1569 
1570  MakeTrayRectWithSize(m_Position, &szWnd, &rcTray);
1571  }
1572 
1573  m_TrayRects[m_Position] = rcTray;
1574  }
1575  else if (m_Position != (DWORD)-1)
1576  {
1577  /* If the user isn't resizing the tray window we need to make sure the
1578  new size or position is valid. this is to prevent changes to the window
1579  without user interaction. */
1580  rcTray = m_TrayRects[m_Position];
1581 
1583  {
1584  rcTray.left += m_AutoHideOffset.cx;
1585  rcTray.right += m_AutoHideOffset.cx;
1586  rcTray.top += m_AutoHideOffset.cy;
1587  rcTray.bottom += m_AutoHideOffset.cy;
1588  }
1589 
1590  }
1591 
1592 ChangePos:
1593  m_TraySize.cx = rcTray.right - rcTray.left;
1594  m_TraySize.cy = rcTray.bottom - rcTray.top;
1595 
1596  pwp->flags &= ~(SWP_NOMOVE | SWP_NOSIZE);
1597  pwp->x = rcTray.left;
1598  pwp->y = rcTray.top;
1599  pwp->cx = m_TraySize.cx;
1600  pwp->cy = m_TraySize.cy;
1601  }
1602  }
1603 
1605  {
1606  RECT rcClip, rcWindow;
1607  HRGN hClipRgn;
1608 
1609  if (GetWindowRect(&rcWindow))
1610  {
1611  /* Disable clipping on systems with only one monitor */
1612  if (GetSystemMetrics(SM_CMONITORS) <= 1)
1613  Clip = FALSE;
1614 
1615  if (Clip)
1616  {
1617  rcClip = rcWindow;
1618 
1619  GetScreenRect(m_Monitor, &rcClip);
1620 
1621  if (!IntersectRect(&rcClip, &rcClip, &rcWindow))
1622  {
1623  rcClip = rcWindow;
1624  }
1625 
1626  OffsetRect(&rcClip,
1627  -rcWindow.left,
1628  -rcWindow.top);
1629 
1630  hClipRgn = CreateRectRgnIndirect(&rcClip);
1631  }
1632  else
1633  hClipRgn = NULL;
1634 
1635  /* Set the clipping region or make sure the window isn't clipped
1636  by disabling it explicitly. */
1637  SetWindowRgn(hClipRgn, TRUE);
1638  }
1639  }
1640 
1642  {
1643 #if !WIN7_DEBUG_MODE
1644  RECT rcTray, rcWorkArea;
1645 
1646  /* If monitor has changed then fix the previous monitors work area */
1648  {
1649  GetScreenRect(m_PreviousMonitor, &rcWorkArea);
1650  SystemParametersInfoW(SPI_SETWORKAREA,
1651  1,
1652  &rcWorkArea,
1653  SPIF_SENDCHANGE);
1654  }
1655 
1656  rcTray = m_TrayRects[m_Position];
1657 
1658  GetScreenRect(m_Monitor, &rcWorkArea);
1660 
1661  /* If AutoHide is false then change the workarea to exclude
1662  the area that the taskbar covers. */
1664  {
1665  switch (m_Position)
1666  {
1667  case ABE_TOP:
1668  rcWorkArea.top = rcTray.bottom;
1669  break;
1670  case ABE_LEFT:
1671  rcWorkArea.left = rcTray.right;
1672  break;
1673  case ABE_RIGHT:
1674  rcWorkArea.right = rcTray.left;
1675  break;
1676  case ABE_BOTTOM:
1677  rcWorkArea.bottom = rcTray.top;
1678  break;
1679  }
1680  }
1681 
1682  /*
1683  * Resize the current monitor work area. Win32k will also send
1684  * a WM_SIZE message to automatically resize the desktop.
1685  */
1686  SystemParametersInfoW(SPI_SETWORKAREA,
1687  1,
1688  &rcWorkArea,
1689  SPIF_SENDCHANGE);
1690 #endif
1691  }
1692 
1694  {
1695  /* Force the rebar bands to resize */
1697  IID_IDeskBand,
1699  0,
1700  NULL,
1701  NULL);
1702 
1703  /* Calculate the size of the taskbar based on the rebar */
1705 
1706  /* Move the tray window */
1707  /* The handler of WM_WINDOWPOSCHANGING will override whatever size
1708  * and position we use here with m_TrayRects */
1709  SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE);
1710  ResizeWorkArea();
1712  }
1713 
1715  {
1716  DWORD Pos;
1717  RECT rcScreen;
1718  SIZE WndSize, EdgeSize, DlgFrameSize;
1719  SIZE StartBtnSize = m_StartButton.GetSize();
1720 
1721  EdgeSize.cx = GetSystemMetrics(SM_CXEDGE);
1722  EdgeSize.cy = GetSystemMetrics(SM_CYEDGE);
1723  DlgFrameSize.cx = GetSystemMetrics(SM_CXDLGFRAME);
1724  DlgFrameSize.cy = GetSystemMetrics(SM_CYDLGFRAME);
1725 
1727  rcScreen = g_TaskbarSettings.sr.Rect;
1728  GetScreenRectFromRect(&rcScreen, MONITOR_DEFAULTTONEAREST);
1729 
1731  {
1732  /* Use the minimum size of the taskbar, we'll use the start
1733  button as a minimum for now. Make sure we calculate the
1734  entire window size, not just the client size. However, we
1735  use a thinner border than a standard thick border, so that
1736  the start button and bands are not stuck to the screen border. */
1737  if(!m_Theme)
1738  {
1739  g_TaskbarSettings.sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx));
1740  g_TaskbarSettings.sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
1741  }
1742  else
1743  {
1744  g_TaskbarSettings.sr.Size.cx = StartBtnSize.cx - EdgeSize.cx;
1745  g_TaskbarSettings.sr.Size.cy = StartBtnSize.cy - EdgeSize.cy;
1748  }
1749  }
1750  /* Determine a minimum tray window rectangle. The "client" height is
1751  zero here since we cannot determine an optimal minimum width when
1752  loaded as a vertical tray window. We just need to make sure the values
1753  loaded from the registry are at least. The windows explorer behaves
1754  the same way, it allows the user to save a zero width vertical tray
1755  window, but not a zero height horizontal tray window. */
1756  if(!m_Theme)
1757  {
1758  WndSize.cx = 2 * (EdgeSize.cx + DlgFrameSize.cx);
1759  WndSize.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
1760  }
1761  else
1762  {
1763  WndSize.cx = StartBtnSize.cx;
1764  WndSize.cy = StartBtnSize.cy - EdgeSize.cy;
1765  }
1766 
1767  if (WndSize.cx < g_TaskbarSettings.sr.Size.cx)
1768  WndSize.cx = g_TaskbarSettings.sr.Size.cx;
1769  if (WndSize.cy < g_TaskbarSettings.sr.Size.cy)
1770  WndSize.cy = g_TaskbarSettings.sr.Size.cy;
1771 
1772  /* Save the calculated size */
1773  m_TraySize = WndSize;
1774 
1775  /* Calculate all docking rectangles. We need to do this here so they're
1776  initialized and dragging the tray window to another position gives
1777  usable results */
1778  for (Pos = ABE_LEFT; Pos <= ABE_BOTTOM; Pos++)
1779  {
1781  &rcScreen,
1782  &m_TraySize,
1783  &m_TrayRects[Pos]);
1784  // TRACE("m_TrayRects[%d(%d)]: %d,%d,%d,%d\n", Pos, Position, m_TrayRects[Pos].left, m_TrayRects[Pos].top, m_TrayRects[Pos].right, m_TrayRects[Pos].bottom);
1785  }
1786 
1787  /* Determine which monitor we are on. It shouldn't matter which docked
1788  position rectangle we use */
1790  }
1791 
1793  {
1794  RECT rcClient;
1795  SIZE TraySize, StartSize;
1796  POINT ptTrayNotify = { 0, 0 };
1797  BOOL Horizontal;
1798  HDWP dwp;
1799 
1801  if (prcClient != NULL)
1802  {
1803  rcClient = *prcClient;
1804  }
1805  else
1806  {
1807  if (!GetClientRect(&rcClient))
1808  {
1809  ERR("Could not get client rect lastErr=%d\n", GetLastError());
1810  return;
1811  }
1812  }
1813 
1814  Horizontal = IsPosHorizontal();
1815 
1816  /* We're about to resize/move the start button, the rebar control and
1817  the tray notification control */
1818  dwp = BeginDeferWindowPos(4);
1819  if (dwp == NULL)
1820  {
1821  ERR("BeginDeferWindowPos failed. lastErr=%d\n", GetLastError());
1822  return;
1823  }
1824 
1825  /* Limit the Start button width to the client width, if necessary */
1826  StartSize = m_StartButton.GetSize();
1827  if (StartSize.cx > rcClient.right)
1828  StartSize.cx = rcClient.right;
1829 
1830  HWND hwndTaskToolbar = ::GetWindow(m_TaskSwitch, GW_CHILD);
1831  if (hwndTaskToolbar)
1832  {
1833  DWORD size = SendMessageW(hwndTaskToolbar, TB_GETBUTTONSIZE, 0, 0);
1834 
1835  /* Themed button covers Edge area as well */
1836  StartSize.cy = HIWORD(size) + (m_Theme ? GetSystemMetrics(SM_CYEDGE) : 0);
1837  }
1838 
1839  if (m_StartButton.m_hWnd != NULL)
1840  {
1841  /* Resize and reposition the button */
1842  dwp = m_StartButton.DeferWindowPos(dwp,
1843  NULL,
1844  0,
1845  0,
1846  StartSize.cx,
1847  StartSize.cy,
1849  if (dwp == NULL)
1850  {
1851  ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError());
1852  return;
1853  }
1854  }
1855 
1857  {
1858  // Get rectangle from rcClient
1859  RECT rc = rcClient;
1860  INT cxyShowDesktop = m_ShowDesktopButton.WidthOrHeight();
1861  if (Horizontal)
1862  {
1863  rc.left = rc.right - cxyShowDesktop;
1864  rc.right += 5; // excessive
1865  }
1866  else
1867  {
1868  rc.top = rc.bottom - cxyShowDesktop;
1869  rc.bottom += 5; // excessive
1870  }
1871 
1872  /* Resize and reposition the button */
1874  rc.left, rc.top,
1875  rc.right - rc.left, rc.bottom - rc.top,
1877 
1878  // Adjust rcClient
1879  if (Horizontal)
1880  rcClient.right -= cxyShowDesktop + ::GetSystemMetrics(SM_CXEDGE);
1881  else
1882  rcClient.bottom -= cxyShowDesktop + ::GetSystemMetrics(SM_CYEDGE);
1883  }
1884 
1885  /* Determine the size that the tray notification window needs */
1886  if (Horizontal)
1887  {
1888  TraySize.cx = 0;
1889  TraySize.cy = rcClient.bottom;
1890  }
1891  else
1892  {
1893  TraySize.cx = rcClient.right;
1894  TraySize.cy = 0;
1895  }
1896 
1897  if (m_TrayNotify != NULL &&
1900  (WPARAM)Horizontal,
1901  (LPARAM)&TraySize))
1902  {
1903  /* Move the tray notification window to the desired location */
1904  if (Horizontal)
1905  ptTrayNotify.x = rcClient.right - TraySize.cx;
1906  else
1907  ptTrayNotify.y = rcClient.bottom - TraySize.cy;
1908 
1909  dwp = ::DeferWindowPos(dwp,
1910  m_TrayNotify,
1911  NULL,
1912  ptTrayNotify.x,
1913  ptTrayNotify.y,
1914  TraySize.cx,
1915  TraySize.cy,
1917  if (dwp == NULL)
1918  {
1919  ERR("DeferWindowPos for notification area failed. lastErr=%d\n", GetLastError());
1920  return;
1921  }
1922  }
1923 
1924  /* Resize/Move the rebar control */
1925  if (m_Rebar != NULL)
1926  {
1927  POINT ptRebar = { 0, 0 };
1928  SIZE szRebar;
1929 
1930  SetWindowStyle(m_Rebar, CCS_VERT, Horizontal ? 0 : CCS_VERT);
1931 
1932  if (Horizontal)
1933  {
1934  ptRebar.x = StartSize.cx + GetSystemMetrics(SM_CXSIZEFRAME);
1935  szRebar.cx = ptTrayNotify.x - ptRebar.x;
1936  szRebar.cy = rcClient.bottom;
1937  }
1938  else
1939  {
1940  ptRebar.y = StartSize.cy + GetSystemMetrics(SM_CYSIZEFRAME);
1941  szRebar.cx = rcClient.right;
1942  szRebar.cy = ptTrayNotify.y - ptRebar.y;
1943  }
1944 
1945  dwp = ::DeferWindowPos(dwp,
1946  m_Rebar,
1947  NULL,
1948  ptRebar.x,
1949  ptRebar.y,
1950  szRebar.cx,
1951  szRebar.cy,
1953  }
1954 
1955  if (dwp != NULL)
1956  EndDeferWindowPos(dwp);
1957 
1958  if (m_TaskSwitch != NULL)
1959  {
1960  /* Update the task switch window configuration */
1962  }
1963  }
1964 
1965  void FitToRebar(PRECT pRect)
1966  {
1967  /* Get the rect of the rebar */
1968  RECT rebarRect, taskbarRect, clientRect;
1969  ::GetWindowRect(m_Rebar, &rebarRect);
1970  ::GetWindowRect(m_hWnd, &taskbarRect);
1971  ::GetClientRect(m_hWnd, &clientRect);
1972  OffsetRect(&rebarRect, -taskbarRect.left, -taskbarRect.top);
1973 
1974  /* Calculate the difference of size of the taskbar and the rebar */
1975  SIZE margins;
1976  margins.cx = taskbarRect.right - taskbarRect.left - clientRect.right + clientRect.left;
1977  margins.cy = taskbarRect.bottom - taskbarRect.top - clientRect.bottom + clientRect.top;
1978 
1979  /* Calculate the new size of the rebar and make it resize, then change the new taskbar size */
1980  switch (m_Position)
1981  {
1982  case ABE_TOP:
1983  rebarRect.bottom = rebarRect.top + pRect->bottom - pRect->top - margins.cy;
1985  pRect->bottom = pRect->top + rebarRect.bottom - rebarRect.top + margins.cy;
1986  break;
1987  case ABE_BOTTOM:
1988  rebarRect.top = rebarRect.bottom - (pRect->bottom - pRect->top - margins.cy);
1990  pRect->top = pRect->bottom - (rebarRect.bottom - rebarRect.top + margins.cy);
1991  break;
1992  case ABE_LEFT:
1993  rebarRect.right = rebarRect.left + (pRect->right - pRect->left - margins.cx);
1995  pRect->right = pRect->left + (rebarRect.right - rebarRect.left + margins.cx);
1996  break;
1997  case ABE_RIGHT:
1998  rebarRect.left = rebarRect.right - (pRect->right - pRect->left - margins.cx);
2000  pRect->left = pRect->right - (rebarRect.right - rebarRect.left + margins.cx);
2001  break;
2002  }
2003 
2005  }
2006 
2008  {
2009  if (m_StartMenuPopup != NULL)
2010  {
2011  POINTL pt;
2012  RECTL rcExclude;
2013  DWORD dwFlags = 0;
2014 
2015  if (m_StartButton.GetWindowRect((RECT*) &rcExclude))
2016  {
2017  switch (m_Position)
2018  {
2019  case ABE_BOTTOM:
2020  pt.x = rcExclude.left;
2021  pt.y = rcExclude.top;
2022  dwFlags |= MPPF_TOP;
2023  break;
2024  case ABE_TOP:
2025  pt.x = rcExclude.left;
2026  pt.y = rcExclude.bottom;
2027  dwFlags |= MPPF_BOTTOM;
2028  break;
2029  case ABE_LEFT:
2030  pt.x = rcExclude.right;
2031  pt.y = rcExclude.top;
2032  dwFlags |= MPPF_RIGHT;
2033  break;
2034  case ABE_RIGHT:
2035  pt.x = rcExclude.left;
2036  pt.y = rcExclude.top;
2037  dwFlags |= MPPF_LEFT;
2038  break;
2039  }
2040 
2041  m_StartMenuPopup->Popup(&pt, &rcExclude, dwFlags);
2042 
2043  m_StartButton.SendMessageW(BM_SETSTATE, TRUE, 0);
2044  }
2045  }
2046  }
2047 
2049  {
2050  RECT rcCurrent;
2051  POINT pt;
2052  BOOL over;
2054 
2055  GetCursorPos(&pt);
2056  GetWindowRect(&rcCurrent);
2057  over = PtInRect(&rcCurrent, pt);
2058 
2060  {
2061  over = TRUE;
2062  }
2063 
2064  if (over)
2065  {
2066  if (state == AUTOHIDE_HIDING)
2067  {
2068  TRACE("AutoHide cancelling hide.\n");
2071  }
2072  else if (state == AUTOHIDE_HIDDEN)
2073  {
2074  TRACE("AutoHide starting show.\n");
2077  }
2078  }
2079  else
2080  {
2081  if (state == AUTOHIDE_SHOWING)
2082  {
2083  TRACE("AutoHide cancelling show.\n");
2086  }
2087  else if (state == AUTOHIDE_SHOWN)
2088  {
2089  TRACE("AutoHide starting hide.\n");
2092  }
2093 
2095  }
2096  }
2097 
2099  {
2102 
2103  switch (m_AutoHideState)
2104  {
2105  case AUTOHIDE_HIDING:
2106  switch (m_Position)
2107  {
2108  case ABE_LEFT:
2109  m_AutoHideOffset.cy = 0;
2111  if (m_AutoHideOffset.cx < -w)
2112  m_AutoHideOffset.cx = w;
2113  break;
2114  case ABE_TOP:
2115  m_AutoHideOffset.cx = 0;
2117  if (m_AutoHideOffset.cy < -h)
2118  m_AutoHideOffset.cy = h;
2119  break;
2120  case ABE_RIGHT:
2121  m_AutoHideOffset.cy = 0;
2123  if (m_AutoHideOffset.cx > w)
2124  m_AutoHideOffset.cx = w;
2125  break;
2126  case ABE_BOTTOM:
2127  m_AutoHideOffset.cx = 0;
2129  if (m_AutoHideOffset.cy > h)
2130  m_AutoHideOffset.cy = h;
2131  break;
2132  }
2133 
2134  if (m_AutoHideOffset.cx != w && m_AutoHideOffset.cy != h)
2135  {
2137  break;
2138  }
2139 
2140  /* fallthrough */
2141  case AUTOHIDE_HIDDEN:
2142 
2143  switch (m_Position)
2144  {
2145  case ABE_LEFT:
2146  m_AutoHideOffset.cx = -w;
2147  m_AutoHideOffset.cy = 0;
2148  break;
2149  case ABE_TOP:
2150  m_AutoHideOffset.cx = 0;
2151  m_AutoHideOffset.cy = -h;
2152  break;
2153  case ABE_RIGHT:
2154  m_AutoHideOffset.cx = w;
2155  m_AutoHideOffset.cy = 0;
2156  break;
2157  case ABE_BOTTOM:
2158  m_AutoHideOffset.cx = 0;
2159  m_AutoHideOffset.cy = h;
2160  break;
2161  }
2162 
2165  break;
2166 
2167  case AUTOHIDE_SHOWING:
2169  {
2171  }
2173  {
2175  }
2176  else
2177  {
2178  m_AutoHideOffset.cx = 0;
2179  }
2180 
2182  {
2184  }
2186  {
2188  }
2189  else
2190  {
2191  m_AutoHideOffset.cy = 0;
2192  }
2193 
2194  if (m_AutoHideOffset.cx != 0 || m_AutoHideOffset.cy != 0)
2195  {
2197  break;
2198  }
2199 
2200  /* fallthrough */
2201  case AUTOHIDE_SHOWN:
2202 
2205  break;
2206  }
2207 
2208  SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER);
2209  }
2210 
2211 
2212 
2213 
2214 
2215  /**********************************************************
2216  * ##### taskbar drawing #####
2217  */
2218 
2220  {
2221  RECT rect;
2223 
2225 
2226  if (m_Theme)
2227  {
2228  GetClientRect(&rect);
2229  DrawThemeBackground(m_Theme, hdc, iSBkgndPart[m_Position], 0, &rect, 0);
2230  }
2231 
2232  return 0;
2233  }
2234 
2236  {
2237  HDC hdc;
2238  RECT rect;
2240  SIZE size;
2241 
2243 
2244  HRESULT hr = GetThemePartSize(m_Theme, NULL, iSizerPart[m_Position], 0, NULL, TS_TRUE, &size);
2245  if (FAILED_UNEXPECTEDLY(hr))
2246  return 0;
2247 
2248  GetWindowRect(&rect);
2249  OffsetRect(&rect, -rect.left, -rect.top);
2250 
2251  hdc = GetWindowDC();
2252 
2253  switch (m_Position)
2254  {
2255  case ABE_LEFT:
2256  rect.left = rect.right - size.cx;
2257  break;
2258  case ABE_TOP:
2259  rect.top = rect.bottom - size.cy;
2260  break;
2261  case ABE_RIGHT:
2262  rect.right = rect.left + size.cx;
2263  break;
2264  case ABE_BOTTOM:
2265  default:
2266  rect.bottom = rect.top + size.cy;
2267  break;
2268  }
2269 
2270  DrawThemeBackground(m_Theme, hdc, iSizerPart[m_Position], 0, &rect, 0);
2271 
2272  ReleaseDC(hdc);
2273  return 0;
2274  }
2275 
2276 
2277 
2278 
2279 
2280  /*
2281  * ITrayWindow
2282  */
2284  {
2285  RECT rcWnd;
2286 
2287  /* Check if there's already a window created and try to show it.
2288  If it was somehow destroyed just create a new tray window. */
2289  if (m_hWnd != NULL && IsWindow())
2290  {
2291  return S_OK;
2292  }
2293 
2294  DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE;
2296  dwExStyle |= WS_EX_TOPMOST;
2297 
2299  if(!m_Theme)
2300  {
2301  dwStyle |= WS_THICKFRAME | WS_BORDER;
2302  }
2303 
2304  ZeroMemory(&rcWnd, sizeof(rcWnd));
2305  if (m_Position != (DWORD) -1)
2306  rcWnd = m_TrayRects[m_Position];
2307 
2308  if (!Create(NULL, rcWnd, NULL, dwStyle, dwExStyle))
2309  return E_FAIL;
2310 
2311  /* Align all controls on the tray window */
2313 
2314  /* Move the tray window to the right position and resize it if necessary */
2316 
2317  return S_OK;
2318  }
2319 
2321  {
2322  if (m_hWnd != NULL)
2323  {
2326  0,
2327  0);
2328  }
2329 
2330  return S_OK;
2331  }
2332 
2334  {
2335  return m_hWnd;
2336  }
2337 
2339  {
2340  return (m_hWnd == hWnd ||
2341  (m_DesktopWnd != NULL && m_hWnd == m_DesktopWnd));
2342  }
2343 
2345  {
2346  return IsPosHorizontal();
2347  }
2348 
2350  {
2351  BOOL bPrevLock = g_TaskbarSettings.bLock;
2352 
2353  if (g_TaskbarSettings.bLock != bLock)
2354  {
2355  g_TaskbarSettings.bLock = bLock;
2356 
2357  if (m_TrayBandSite != NULL)
2358  {
2359  if (!SUCCEEDED(m_TrayBandSite->Lock(bLock)))
2360  {
2361  /* Reset?? */
2362  g_TaskbarSettings.bLock = bPrevLock;
2363  return bPrevLock;
2364  }
2365  }
2366 
2367  if (m_Theme)
2368  {
2369  /* Update cached tray sizes */
2370  for(DWORD Pos = ABE_LEFT; Pos <= ABE_BOTTOM; Pos++)
2371  {
2372  RECT rcGripper = {0};
2373  AdjustSizerRect(&rcGripper, Pos);
2374 
2376  {
2377  m_TrayRects[Pos].top += rcGripper.top;
2378  m_TrayRects[Pos].left += rcGripper.left;
2379  m_TrayRects[Pos].bottom += rcGripper.bottom;
2380  m_TrayRects[Pos].right += rcGripper.right;
2381  }
2382  else
2383  {
2384  m_TrayRects[Pos].top -= rcGripper.top;
2385  m_TrayRects[Pos].left -= rcGripper.left;
2386  m_TrayRects[Pos].bottom -= rcGripper.bottom;
2387  m_TrayRects[Pos].right -= rcGripper.right;
2388  }
2389  }
2390  }
2392  ResizeWorkArea();
2394  }
2395 
2396  return bPrevLock;
2397  }
2398 
2399 
2400  /*
2401  * IContextMenu
2402  */
2404  UINT indexMenu,
2405  UINT idCmdFirst,
2406  UINT idCmdLast,
2407  UINT uFlags)
2408  {
2409  if (!m_ContextMenu)
2410  {
2412  if (FAILED_UNEXPECTEDLY(hr))
2413  return hr;
2414  }
2415 
2416  return m_ContextMenu->QueryContextMenu(hPopup, indexMenu, idCmdFirst, idCmdLast, uFlags);
2417  }
2418 
2420  {
2421  if (!m_ContextMenu)
2422  return E_INVALIDARG;
2423 
2424  return m_ContextMenu->InvokeCommand(lpici);
2425  }
2426 
2428  UINT uType,
2429  UINT *pwReserved,
2430  LPSTR pszName,
2431  UINT cchMax)
2432  {
2433  if (!m_ContextMenu)
2434  return E_INVALIDARG;
2435 
2436  return m_ContextMenu->GetCommandString(idCmd, uType, pwReserved, pszName, cchMax);
2437  }
2438 
2439  BOOL IsShowDesktopButtonNeeded() // Read the registry value
2440  {
2441  return SHRegGetBoolUSValueW(
2442  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
2443  L"TaskbarSd",
2444  FALSE,
2445  TRUE);
2446  }
2447 
2448  /**********************************************************
2449  * ##### message handling #####
2450  */
2451 
2453  {
2454  HRESULT hRet;
2455 
2456  ((ITrayWindow*)this)->AddRef();
2457 
2458  SetWindowTheme(m_hWnd, L"TaskBar", NULL);
2459 
2460  /* Create the Start button */
2462 
2463  /* Create the 'Show Desktop' button if necessary */
2466 
2467  /* Load the saved tray window settings */
2468  RegLoadSettings();
2469 
2470  /* Create and initialize the start menu */
2472  m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0);
2473 
2474  /* Create the task band */
2476  if (FAILED_UNEXPECTEDLY(hRet))
2477  return FALSE;
2478 
2479  /* Create the rebar band site. This actually creates the rebar and the tasks toolbar. */
2481  if (FAILED_UNEXPECTEDLY(hRet))
2482  return FALSE;
2483 
2484  /* Create the tray notification window */
2486  if (FAILED_UNEXPECTEDLY(hRet))
2487  return FALSE;
2488 
2489  /* Get the hwnd of the rebar */
2491  if (FAILED_UNEXPECTEDLY(hRet))
2492  return FALSE;
2493 
2494  /* Get the hwnd of the tasks toolbar */
2496  if (FAILED_UNEXPECTEDLY(hRet))
2497  return FALSE;
2498 
2499  /* Get the hwnd of the tray notification window */
2501  if (FAILED_UNEXPECTEDLY(hRet))
2502  return FALSE;
2503 
2504  SetWindowTheme(m_Rebar, L"TaskBar", NULL);
2505 
2506  UpdateFonts();
2507 
2509 
2511  {
2514  }
2515 
2516  /* Set the initial lock state in the band site */
2518 
2531 
2532  return TRUE;
2533  }
2534 
2536  {
2537  if (m_Theme)
2539 
2540  m_Theme = OpenThemeData(m_hWnd, L"TaskBar");
2541 
2542  if (m_Theme)
2543  {
2545  }
2546  else
2547  {
2549  }
2551 
2552  return TRUE;
2553  }
2554 
2556  {
2557  if (wParam == SPI_SETNONCLIENTMETRICS)
2558  {
2561  UpdateFonts();
2564  }
2565 
2566  return 0;
2567  }
2568 
2570  {
2571  HDC hdc = (HDC) wParam;
2572 
2573  if (!m_Theme)
2574  {
2575  bHandled = FALSE;
2576  return 0;
2577  }
2578 
2579  return EraseBackgroundWithTheme(hdc);
2580  }
2581 
2583  {
2584  /* Load the saved tray window settings */
2585  RegLoadSettings();
2586 
2587  /* Move the tray window to the right position and resize it if necessary */
2589 
2590  return TRUE;
2591  }
2592 
2594  {
2595  COPYDATASTRUCT *pCopyData = reinterpret_cast<COPYDATASTRUCT *>(lParam);
2596  switch (pCopyData->dwData)
2597  {
2598  case TABDMC_APPBAR:
2599  return appbar_message(pCopyData);
2600  case TABDMC_NOTIFY:
2601  case TABDMC_LOADINPROC:
2603  }
2604  return FALSE;
2605  }
2606 
2607  // We have to draw non-client area because the 'Show Desktop' button is beyond client area.
2609  {
2611  return;
2612  // Get the rectangle in window coordinates
2613  RECT rcButton, rcWnd;
2614  GetWindowRect(&rcWnd);
2616  ::OffsetRect(&rcButton, -rcWnd.left, -rcWnd.top);
2617 
2619  m_ShowDesktopButton.OnDraw(hdc, &rcButton); // Draw the button
2620  ReleaseDC(hdc);
2621  }
2622 
2624  {
2625  DefWindowProc(uMsg, wParam, lParam);
2626  bHandled = TRUE;
2627 
2629  {
2630  DrawShowDesktopButton(); // We have to draw non-client area
2631  return 0;
2632  }
2633 
2634  DrawSizerWithTheme((HRGN) wParam);
2635  DrawShowDesktopButton(); // We have to draw non-client area
2636  return 0;
2637  }
2638 
2640  {
2643  }
2644 
2646  {
2647  RECT rcClient;
2648  POINT pt;
2649 
2651  {
2652  /* The user may not be able to resize the tray window.
2653  Pretend like the window is not sizeable when the user
2654  clicks on the border. */
2655  return HTBORDER;
2656  }
2657 
2659  if (GetClientRect(&rcClient) &&
2660  (MapWindowPoints(NULL, (LPPOINT) &rcClient, 2) != 0 || GetLastError() == ERROR_SUCCESS))
2661  {
2662  pt.x = (SHORT) LOWORD(lParam);
2663  pt.y = (SHORT) HIWORD(lParam);
2664 
2665  if (PtInRect(&rcClient, pt))
2666  {
2667  /* The user is trying to drag the tray window */
2668  return HTCAPTION;
2669  }
2670 
2671  /* Depending on the position of the tray window, allow only
2672  changing the border next to the monitor working area */
2673  switch (m_Position)
2674  {
2675  case ABE_TOP:
2676  if (pt.y > rcClient.bottom)
2677  return HTBOTTOM;
2678  break;
2679  case ABE_LEFT:
2680  if (pt.x > rcClient.right)
2681  return HTRIGHT;
2682  break;
2683  case ABE_RIGHT:
2684  if (pt.x < rcClient.left)
2685  return HTLEFT;
2686  break;
2687  case ABE_BOTTOM:
2688  default:
2689  if (pt.y < rcClient.top)
2690  return HTTOP;
2691  break;
2692  }
2693  }
2694  return HTBORDER;
2695  }
2696 
2698  {
2699  POINT ptCursor;
2700  PRECT pRect = (PRECT) lParam;
2701 
2702  /* We need to ensure that an application can not accidently
2703  move the tray window (using SetWindowPos). However, we still
2704  need to be able to move the window in case the user wants to
2705  drag the tray window to another position or in case the user
2706  wants to resize the tray window. */
2707  if (!g_TaskbarSettings.bLock && GetCursorPos(&ptCursor))
2708  {
2709  IsDragging = TRUE;
2711  }
2712  else
2713  {
2714  *pRect = m_TrayRects[m_Position];
2715  }
2716  return TRUE;
2717  }
2718 
2720  {
2721  PRECT pRect = (PRECT) lParam;
2722 
2723  if (!g_TaskbarSettings.bLock)
2724  {
2725  FitToRebar(pRect);
2726  }
2727  else
2728  {
2729  *pRect = m_TrayRects[m_Position];
2730  }
2731  return TRUE;
2732  }
2733 
2735  {
2737  return TRUE;
2738  }
2739 
2741  {
2742  RECT rcClient;
2743  if (wParam == SIZE_RESTORED && lParam == 0)
2744  {
2745  ResizeWorkArea();
2746  /* Clip the tray window on multi monitor systems so the edges can't
2747  overlap into another monitor */
2749 
2750  if (!GetClientRect(&rcClient))
2751  {
2752  return FALSE;
2753  }
2754  }
2755  else
2756  {
2757  rcClient.left = rcClient.top = 0;
2758  rcClient.right = LOWORD(lParam);
2759  rcClient.bottom = HIWORD(lParam);
2760  }
2761 
2762  AlignControls(&rcClient);
2763  return TRUE;
2764  }
2765 
2767  {
2768  InSizeMove = TRUE;
2769  IsDragging = FALSE;
2770  if (!g_TaskbarSettings.bLock)
2771  {
2772  /* Remove the clipping on multi monitor systems while dragging around */
2774  }
2775  return TRUE;
2776  }
2777 
2779  {
2780  InSizeMove = FALSE;
2781  if (!g_TaskbarSettings.bLock)
2782  {
2784 
2785  /* Apply clipping */
2787  }
2788  return TRUE;
2789  }
2790 
2792  {
2793  switch (wParam)
2794  {
2795  case TEXT(' '):
2796  {
2797  /* The user pressed Alt+Space, this usually brings up the system menu of a window.
2798  The tray window needs to handle this specially, since it normally doesn't have
2799  a system menu. */
2800 
2801  static const UINT uidDisableItem [] = {
2802  SC_RESTORE,
2803  SC_MOVE,
2804  SC_SIZE,
2805  SC_MAXIMIZE,
2806  SC_MINIMIZE,
2807  };
2808  HMENU hSysMenu;
2809  UINT i, uId;
2810 
2811  /* temporarily enable the system menu */
2813 
2814  hSysMenu = GetSystemMenu(FALSE);
2815  if (hSysMenu != NULL)
2816  {
2817  /* Disable all items that are not relevant */
2818  for (i = 0; i < _countof(uidDisableItem); i++)
2819  {
2820  EnableMenuItem(hSysMenu,
2821  uidDisableItem[i],
2823  }
2824 
2825  EnableMenuItem(hSysMenu,
2826  SC_CLOSE,
2827  MF_BYCOMMAND |
2829 
2830  /* Display the system menu */
2831  uId = TrackMenu(
2832  hSysMenu,
2833  NULL,
2835  m_Position != ABE_TOP,
2836  FALSE);
2837  if (uId != 0)
2838  {
2839  SendMessage(m_hWnd, WM_SYSCOMMAND, (WPARAM) uId, 0);
2840  }
2841  }
2842 
2843  /* revert the system menu window style */
2845  break;
2846  }
2847 
2848  default:
2849  bHandled = FALSE;
2850  }
2851  return TRUE;
2852  }
2853 
2855  {
2856  /* This handler implements the trick that makes the start button to
2857  get pressed when the user clicked left or below the button */
2858 
2860  WINDOWINFO wi = {sizeof(WINDOWINFO)};
2861 
2862  bHandled = FALSE;
2863 
2864  RECT rcStartBtn;
2865  m_StartButton.GetWindowRect(&rcStartBtn);
2866 
2867  GetWindowInfo(m_hWnd, &wi);
2868 
2869  switch (m_Position)
2870  {
2871  case ABE_TOP:
2872  case ABE_LEFT:
2873  {
2874  if (pt.x > rcStartBtn.right || pt.y > rcStartBtn.bottom)
2875  return 0;
2876  break;
2877  }
2878  case ABE_RIGHT:
2879  {
2880  if (pt.x < rcStartBtn.left || pt.y > rcStartBtn.bottom)
2881  return 0;
2882 
2883  if (rcStartBtn.right + (int)wi.cxWindowBorders * 2 + 1 < wi.rcWindow.right &&
2884  pt.x > rcStartBtn.right)
2885  {
2886  return 0;
2887  }
2888  break;
2889  }
2890  case ABE_BOTTOM:
2891  {
2892  if (pt.x > rcStartBtn.right || pt.y < rcStartBtn.top)
2893  return 0;
2894 
2895  if (rcStartBtn.bottom + (int)wi.cyWindowBorders * 2 + 1 < wi.rcWindow.bottom &&
2896  pt.y > rcStartBtn.bottom)
2897  {
2898  return 0;
2899  }
2900 
2901  break;
2902  }
2903  }
2904 
2905  bHandled = TRUE;
2906  PopupStartMenu();
2907  return 0;
2908  }
2909 
2911  {
2912  /* We want the user to be able to get a context menu even on the nonclient
2913  area (including the sizing border)! */
2914  uMsg = WM_CONTEXTMENU;
2915  wParam = (WPARAM) m_hWnd;
2916 
2917  return OnContextMenu(uMsg, wParam, lParam, bHandled);
2918  }
2919 
2921  {
2922  LRESULT Ret = FALSE;
2923  POINT pt, *ppt = NULL;
2924  HWND hWndExclude = NULL;
2925 
2926  /* Check if the administrator has forbidden access to context menus */
2928  return FALSE;
2929 
2930  pt.x = (SHORT) LOWORD(lParam);
2931  pt.y = (SHORT) HIWORD(lParam);
2932 
2933  if (pt.x != -1 || pt.y != -1)
2934  ppt = &pt;
2935  else
2936  hWndExclude = m_StartButton.m_hWnd;
2937 
2938  if ((HWND) wParam == m_StartButton.m_hWnd)
2939  {
2940  /* Make sure we can't track the context menu if the start
2941  menu is currently being shown */
2943  {
2944  CComPtr<IContextMenu> ctxMenu;
2946  ctxMenu->AddRef();
2947  TrackCtxMenu(ctxMenu, ppt, hWndExclude, m_Position == ABE_BOTTOM, this);
2948  }
2949  }
2950  else
2951  {
2952  /* See if the context menu should be handled by the task band site */
2953  if (ppt != NULL && m_TrayBandSite != NULL)
2954  {
2955  HWND hWndAtPt;
2956  POINT ptClient = *ppt;
2957 
2958  /* Convert the coordinates to client-coordinates */
2959  ::MapWindowPoints(NULL, m_hWnd, &ptClient, 1);
2960 
2961  hWndAtPt = ChildWindowFromPoint(ptClient);
2962  if (hWndAtPt != NULL &&
2963  (hWndAtPt == m_Rebar || ::IsChild(m_Rebar, hWndAtPt)))
2964  {
2965  /* Check if the user clicked on the task switch window */
2966  ptClient = *ppt;
2967  ::MapWindowPoints(NULL, m_Rebar, &ptClient, 1);
2968 
2970  if (hWndAtPt == m_TaskSwitch)
2971  goto HandleTrayContextMenu;
2972 
2973  /* Forward the message to the task band site */
2974  m_TrayBandSite->ProcessMessage(m_hWnd, uMsg, wParam, lParam, &Ret);
2975  }
2976  else
2977  goto HandleTrayContextMenu;
2978  }
2979  else
2980  {
2981 HandleTrayContextMenu:
2982  /* Tray the default tray window context menu */
2983  TrackCtxMenu(this, ppt, NULL, FALSE, this);
2984  }
2985  }
2986  return Ret;
2987  }
2988 
2990  {
2991  LRESULT Ret = FALSE;
2992  /* FIXME: We can't check with IsChild whether the hwnd is somewhere inside
2993  the rebar control! But we shouldn't forward messages that the band
2994  site doesn't handle, such as other controls (start button, tray window */
2995 
2996  HRESULT hr = E_FAIL;
2997 
2998  if (m_TrayBandSite)
2999  {
3000  hr = m_TrayBandSite->ProcessMessage(m_hWnd, uMsg, wParam, lParam, &Ret);
3001  if (SUCCEEDED(hr))
3002  return Ret;
3003  }
3004 
3005  if (m_TrayBandSite == NULL || FAILED(hr))
3006  {
3007  const NMHDR *nmh = (const NMHDR *) lParam;
3008 
3009  if (nmh->hwndFrom == m_TrayNotify)
3010  {
3011  switch (nmh->code)
3012  {
3013  case NTNWM_REALIGN:
3014  /* Cause all controls to be aligned */
3016  break;
3017  }
3018  }
3019  }
3020  return Ret;
3021  }
3022 
3024  {
3026  if (m_ShowDesktopButton.PtInButton(pt)) // Did you click the button?
3027  {
3029  bHandled = TRUE;
3030  return TRUE;
3031  }
3032 
3033  return FALSE;
3034  }
3035 
3037  {
3038  /* Let the clock handle the double click */
3040 
3041  /* We "handle" this message so users can't cause a weird maximize/restore
3042  window animation when double-clicking the tray window! */
3043  return TRUE;
3044  }
3045 
3047  {
3049  return FALSE;
3050  }
3051 
3053  {
3054  DestroyWindow();
3055  return TRUE;
3056  }
3057 
3059  {
3060  HWND hwndStartMenu;
3061  HRESULT hr = IUnknown_GetWindow(m_StartMenuPopup, &hwndStartMenu);
3062  if (FAILED_UNEXPECTEDLY(hr))
3063  return FALSE;
3064 
3065  if (::IsWindowVisible(hwndStartMenu))
3066  {
3067  m_StartMenuPopup->OnSelect(MPOS_CANCELLEVEL);
3068  }
3069  else
3070  {
3071  PopupStartMenu();
3072  }
3073 
3074  return TRUE;
3075  }
3076 
3078  {
3079  /*
3080  * TWM_DOEXITWINDOWS is send by the CDesktopBrowser to us
3081  * to show the shutdown dialog. Also a WM_CLOSE message sent
3082  * by apps should show the dialog.
3083  */
3084  return DoExitWindows();
3085  }
3086 
3088  {
3089  if (wParam == SC_CLOSE)
3090  {
3091  return DoExitWindows();
3092  }
3093 
3094  bHandled = FALSE;
3095  return TRUE;
3096  }
3097 
3099  {
3100  bHandled = TRUE;
3101  return (LRESULT)m_TaskSwitch;
3102  }
3103 
3105  {
3106  return HandleHotKey(wParam);
3107  }
3108 
3110  {
3117  };
3118 
3120  {
3121  WCHAR szClass[32];
3122  GetClassNameW(hwnd, szClass, _countof(szClass));
3123  return wcscmp(szClass, L"#32770") == 0;
3124  }
3125 
3127  {
3129  if (hwnd == info->hwndDesktop || hwnd == info->hTrayWnd ||
3130  hwnd == info->hwndProgman)
3131  {
3132  return TRUE;
3133  }
3134  if (!info->bShowDesktop)
3135  {
3136  if (!::IsWindowEnabled(hwnd) || IsDialog(hwnd))
3137  return TRUE;
3138  HWND hwndOwner = ::GetWindow(hwnd, GW_OWNER);
3139  if (hwndOwner && !::IsWindowEnabled(hwndOwner))
3140  return TRUE;
3141  }
3142  if (::IsWindowVisible(hwnd) && !::IsIconic(hwnd))
3143  {
3145  info->bRet = TRUE;
3146  info->pMinimizedAll->Add(hwnd);
3147  }
3148  return TRUE;
3149  }
3150 
3151  VOID MinimizeAll(BOOL bShowDesktop = FALSE)
3152  {
3154  info.hwndDesktop = GetDesktopWindow();;
3155  info.hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
3156  info.hwndProgman = FindWindowW(L"Progman", NULL);
3157  info.bRet = FALSE;
3158  info.pMinimizedAll = &g_MinimizedAll;
3159  info.bShowDesktop = bShowDesktop;
3161 
3162  // invalid handles should be cleared to avoid mismatch of handles
3163  for (INT i = 0; i < g_MinimizedAll.GetSize(); ++i)
3164  {
3165  if (!::IsWindow(g_MinimizedAll[i]))
3166  g_MinimizedAll[i] = NULL;
3167  }
3168 
3171  }
3172 
3174  {
3175  MinimizeAll(TRUE);
3176  }
3177 
3179  {
3180  for (INT i = g_MinimizedAll.GetSize() - 1; i >= 0; --i)
3181  {
3183  if (::IsWindowVisible(hwnd) && ::IsIconic(hwnd))
3184  {
3186  }
3187  }
3188  g_MinimizedAll.RemoveAll();
3189  }
3190 
3192  {
3193  LRESULT Ret = FALSE;
3194 
3195  if ((HWND) lParam == m_StartButton.m_hWnd)
3196  {
3197  return FALSE;
3198  }
3199 
3200  if (m_TrayBandSite == NULL || FAILED_UNEXPECTEDLY(m_TrayBandSite->ProcessMessage(m_hWnd, uMsg, wParam, lParam, &Ret)))
3201  {
3202  return HandleCommand(LOWORD(wParam));
3203  }
3204  return Ret;
3205  }
3206 
3208  {
3209  POINT pt;
3210  ::GetCursorPos(&pt);
3213 
3215  {
3217  }
3218 
3219  return TRUE;
3220  }
3221 
3223  {
3224  if (wParam == TIMER_ID_MOUSETRACK)
3225  {
3227  }
3228  else if (wParam == TIMER_ID_AUTOHIDE)
3229  {
3230  ProcessAutoHide();
3231  }
3232 
3233  bHandled = FALSE;
3234  return TRUE;
3235  }
3236 
3238  {
3240  DrawShowDesktopButton(); // We have to draw non-client area
3241  bHandled = TRUE;
3242  return ret;
3243  }
3244 
3246  {
3247  RECT *rc = NULL;
3248  /* Ignore WM_NCCALCSIZE if we are not themed or locked */
3250  {
3251  bHandled = FALSE;
3252  return 0;
3253  }
3254  if(!wParam)
3255  {
3256  rc = (RECT*)wParam;
3257  }
3258  else
3259  {
3261  if(prms->lppos->flags & SWP_NOSENDCHANGING)
3262  {
3263  bHandled = FALSE;
3264  return 0;
3265  }
3266  rc = &prms->rgrc[0];
3267  }
3268 
3270 
3271  return 0;
3272  }
3273 
3275  {
3276  HMENU hMenu = (HMENU)wParam;
3278  {
3282  }
3283  else
3284  {
3288  }
3289  return 0;
3290  }
3291 
3293  {
3294 #if 0
3295  LPNMRBAUTOSIZE as = (LPNMRBAUTOSIZE) nmhdr;
3296 
3297  if (!as->fChanged)
3298  return 0;
3299 
3300  RECT rc;
3301  ::GetWindowRect(m_hWnd, &rc);
3302 
3303  SIZE szWindow = {
3304  rc.right - rc.left,
3305  rc.bottom - rc.top };
3306  SIZE szTarget = {
3307  as->rcTarget.right - as->rcTarget.left,
3308  as->rcTarget.bottom - as->rcTarget.top };
3309  SIZE szActual = {
3310  as->rcActual.right - as->rcActual.left,
3311  as->rcActual.bottom - as->rcActual.top };
3312 
3313  SIZE borders = {
3314  szWindow.cx - szTarget.cx,
3315  szWindow.cy - szTarget.cx,
3316  };
3317 
3318  switch (m_Position)
3319  {
3320  case ABE_LEFT:
3321  szWindow.cx = szActual.cx + borders.cx;
3322  break;
3323  case ABE_TOP:
3324  szWindow.cy = szActual.cy + borders.cy;
3325  break;
3326  case ABE_RIGHT:
3327  szWindow.cx = szActual.cx + borders.cx;
3328  rc.left = rc.right - szWindow.cy;
3329  break;
3330  case ABE_BOTTOM:
3331  szWindow.cy = szActual.cy + borders.cy;
3332  rc.top = rc.bottom - szWindow.cy;
3333  break;
3334  }
3335 
3336  SetWindowPos(NULL, rc.left, rc.top, szWindow.cx, szWindow.cy, SWP_NOACTIVATE | SWP_NOZORDER);
3337 #else
3338  bHandled = FALSE;
3339 #endif
3340  return 0;
3341  }
3342 
3344  {
3345  TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
3346 
3347  /* Propagate the new settings to the children */
3350 
3351  /* Toggle autohide */
3352  if (newSettings->sr.AutoHide != g_TaskbarSettings.sr.AutoHide)
3353  {
3354  g_TaskbarSettings.sr.AutoHide = newSettings->sr.AutoHide;
3357  if (!newSettings->sr.AutoHide)
3358  SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER);
3359  else
3361  }
3362 
3363  /* Toggle lock state */
3364  Lock(newSettings->bLock);
3365 
3366  /* Toggle OnTop state */
3367  if (newSettings->sr.AlwaysOnTop != g_TaskbarSettings.sr.AlwaysOnTop)
3368  {
3370  HWND hWndInsertAfter = newSettings->sr.AlwaysOnTop ? HWND_TOPMOST : HWND_BOTTOM;
3371  SetWindowPos(hWndInsertAfter, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
3372  }
3373 
3375  return 0;
3376  }
3377 
3379 
3382  {
3383  MSG Msg;
3384  LRESULT lRet;
3385 
3386  Msg.hwnd = m_hWnd;
3387  Msg.message = uMsg;
3388  Msg.wParam = wParam;
3389  Msg.lParam = lParam;
3390 
3391  if (m_StartMenuBand->TranslateMenuMessage(&Msg, &lRet) == S_OK)
3392  {
3393  return lRet;
3394  }
3395 
3396  wParam = Msg.wParam;
3397  lParam = Msg.lParam;
3398  }
3399  MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged)
3405  /*MESSAGE_HANDLER(WM_DESTROY, OnDestroy)*/
3412  MESSAGE_HANDLER(WM_DISPLAYCHANGE, OnDisplayChange)
3438  ALT_MSG_MAP(1)
3439  END_MSG_MAP()
3440 
3441  /*****************************************************************************/
3442 
3444  {
3445  MSG Msg;
3446 
3447  /* FIXME: We should keep a reference here... */
3448 
3449  while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
3450  {
3451  if (Msg.message == WM_QUIT)
3452  break;
3453 
3454  if (m_StartMenuBand == NULL ||
3455  m_StartMenuBand->IsMenuMessage(&Msg) != S_OK)
3456  {
3458  DispatchMessage(&Msg);
3459  }
3460  }
3461  }
3462 
3464  {
3465  MSG Msg;
3466  BOOL Ret;
3467 
3468  /* FIXME: We should keep a reference here... */
3469 
3470  while (true)
3471  {
3472  Ret = GetMessage(&Msg, NULL, 0, 0);
3473 
3474  if (!Ret || Ret == -1)
3475  break;
3476 
3477  if (m_StartMenuBand == NULL ||
3478  m_StartMenuBand->IsMenuMessage(&Msg) != S_OK)
3479  {
3481  DispatchMessage(&Msg);
3482  }
3483  }
3484  }
3485 
3486  /*
3487  * IShellDesktopTray
3488  *
3489  * NOTE: this is a very windows-specific COM interface used by SHCreateDesktop()!
3490  * These are the calls I observed, it may be wrong/incomplete/buggy!!!
3491  * The reason we implement it is because we have to use SHCreateDesktop() so
3492  * that the shell provides the desktop window and all the features that come
3493  * with it (especially positioning of desktop icons)
3494  */
3495 
3497  {
3498  /* FIXME: Return ABS_ flags? */
3499  TRACE("IShellDesktopTray::GetState() unimplemented!\n");
3500  return 0;
3501  }
3502 
3504  {
3505  TRACE("IShellDesktopTray::GetTrayWindow(0x%p)\n", phWndTray);
3506  *phWndTray = m_hWnd;
3507  return S_OK;
3508  }
3509 
3511  {
3512  TRACE("IShellDesktopTray::RegisterDesktopWindow(0x%p)\n", hWndDesktop);
3513 
3514  m_DesktopWnd = hWndDesktop;
3515  return S_OK;
3516  }
3517 
3518  virtual HRESULT STDMETHODCALLTYPE Unknown(IN DWORD dwUnknown1, IN DWORD dwUnknown2)
3519  {
3520  TRACE("IShellDesktopTray::Unknown(%u,%u) unimplemented!\n", dwUnknown1, dwUnknown2);
3521  return S_OK;
3522  }
3523 
3525  {
3526  m_StartButton.SendMessageW(BM_SETSTATE, FALSE, 0);
3527  return S_OK;
3528  }
3529 
3531  {
3532  if (!phwnd)
3533  return E_INVALIDARG;
3534  *phwnd = m_hWnd;
3535  return S_OK;
3536  }
3537 
3539  {
3540  return E_NOTIMPL;
3541  }
3542 
3543  void _Init()
3544  {
3545  m_Position = (DWORD) -1;
3546  }
3547 
3549 
3552  /*COM_INTERFACE_ENTRY_IID(IID_ITrayWindow, ITrayWindow)*/
3555  COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
3556  END_COM_MAP()
3557 };
3558 
3562  public IContextMenu
3563 {
3568 
3569 public:
3570  HRESULT Initialize(ITrayWindow * pTrayWnd, IN HWND hWndOwner)
3571  {
3572  this->TrayWnd = (CTrayWindow *) pTrayWnd;
3573  this->hWndOwner = hWndOwner;
3574  this->m_idCmdCmFirst = 0;
3575  return S_OK;
3576  }
3577 
3578  virtual HRESULT STDMETHODCALLTYPE
3580  UINT indexMenu,
3581  UINT idCmdFirst,
3582  UINT idCmdLast,
3583  UINT uFlags)
3584  {
3585  HMENU hMenuBase;
3586 
3588 
3589  if (g_MinimizedAll.GetSize() != 0 && !::IsThereAnyEffectiveWindow(TRUE))
3590  {
3591  CStringW strRestoreAll(MAKEINTRESOURCEW(IDS_RESTORE_ALL));
3592  MENUITEMINFOW mii = { sizeof(mii) };
3593  mii.fMask = MIIM_ID | MIIM_TYPE;
3595  mii.fType = MFT_STRING;
3596  mii.dwTypeData = const_cast<LPWSTR>(&strRestoreAll[0]);
3598  }
3599 
3600  if (!hMenuBase)
3601  return HRESULT_FROM_WIN32(GetLastError());
3602 
3603  if (SHRestricted(REST_CLASSICSHELL) != 0)
3604  {
3605  DeleteMenu(hPopup,
3607  MF_BYCOMMAND);
3608  }
3609 
3610  CheckMenuItem(hMenuBase,
3613 
3614  UINT idCmdNext;
3615  idCmdNext = Shell_MergeMenus(hPopup, hMenuBase, indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS | MM_ADDSEPARATOR);
3616  m_idCmdCmFirst = idCmdNext - idCmdFirst;
3617 
3618  ::DestroyMenu(hMenuBase);
3619 
3620  if (TrayWnd->m_TrayBandSite != NULL)
3621  {
3622  pcm.Release();
3623  if (FAILED(TrayWnd->m_TrayBandSite->AddContextMenus(
3624  hPopup,
3625  indexMenu,
3626  idCmdNext,
3627  idCmdLast,
3628  CMF_NORMAL,
3629  &pcm)))
3630  {
3631  WARN("AddContextMenus failed.\n");
3632  pcm.Release();
3633  }
3634  }
3635 
3636  return S_OK;
3637  }
3638 
3639  virtual HRESULT STDMETHODCALLTYPE
3641  {
3642  UINT uiCmdId = PtrToUlong(lpici->lpVerb);
3643  if (uiCmdId != 0)
3644  {
3645  if (uiCmdId >= m_idCmdCmFirst)
3646  {
3647  CMINVOKECOMMANDINFO cmici = { 0 };
3648 
3649  if (pcm != NULL)
3650  {
3651  /* Setup and invoke the shell command */
3652  cmici.cbSize = sizeof(cmici);
3653  cmici.hwnd = hWndOwner;
3654  cmici.lpVerb = (LPCSTR) MAKEINTRESOURCEW(uiCmdId - m_idCmdCmFirst);
3655  cmici.nShow = SW_NORMAL;
3656 
3657  pcm->InvokeCommand(&cmici);
3658  }
3659  }
3660  else
3661  {
3662  TrayWnd->ExecContextMenuCmd(uiCmdId);
3663  }
3664  }
3665 
3666  return S_OK;
3667  }
3668 
3669  virtual HRESULT STDMETHODCALLTYPE
3671  UINT uType,
3672  UINT *pwReserved,
3673  LPSTR pszName,
3674  UINT cchMax)
3675  {
3676  return E_NOTIMPL;
3677  }
3678 
3680  {
3681  }
3682 
3684  {
3685  }
3686 
3688  COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
3689  END_COM_MAP()
3690 };
3691 
3692 HRESULT TrayWindowCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu)
3693 {
3695  mnu->Initialize(TrayWnd, hWndOwner);
3696  *ppCtxMenu = mnu;
3697  return S_OK;
3698 }
3699 
3700 HRESULT CreateTrayWindow(ITrayWindow ** ppTray)
3701 {
3703  if (Tray == NULL)
3704  return E_OUTOFMEMORY;
3705 
3706  Tray->_Init();
3707  Tray->Open();
3708 
3709  *ppTray = (ITrayWindow *) Tray;
3710 
3711  return S_OK;
3712 }
3713 
3714 HRESULT
3715 Tray_OnStartMenuDismissed(ITrayWindow* Tray)
3716 {
3717  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3718  return TrayWindow->RaiseStartButton();
3719 }
3720 
3721 VOID TrayProcessMessages(ITrayWindow *Tray)
3722 {
3723  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3724  TrayWindow->TrayProcessMessages();
3725 }
3726 
3727 VOID TrayMessageLoop(ITrayWindow *Tray)
3728 {
3729  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3730  TrayWindow->TrayMessageLoop();
3731 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define SHOW_DESKTOP_TIMER_ID
Definition: traywnd.cpp:369
SIZE GetSize()
Definition: traywnd.cpp:164
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1682
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
CComPtr< IContextMenu > pcm
Definition: traywnd.cpp:3566
#define IDHK_NEXT_TASK
Definition: traywnd.cpp:53
#define IDHK_PREV_TASK
Definition: traywnd.cpp:54
DWORD NewPosSize
Definition: traywnd.cpp:520
#define WM_NULL
Definition: winuser.h:1597
EXTERN_C BOOL WINAPI SHFindComputer(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: stubs.cpp:33
HRESULT WINAPI GetThemePartSize(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *psz)
Definition: draw.c:1777
HMONITOR WINAPI MonitorFromPoint(POINT, DWORD)
#define TPM_VERTICAL
Definition: winuser.h:2372
LRESULT OnGetTaskSwitch(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3098
HMONITOR GetMonitorFromRect(IN const RECT *pRect)
Definition: traywnd.cpp:1192
#define WS_DISABLED
Definition: pedump.c:621
#define HTTOP
Definition: winuser.h:2480
#define BS_LEFT
Definition: winuser.h:265
BOOL IsShowDesktopButtonNeeded()
Definition: traywnd.cpp:2439
BOOL IsWindowEnabled() const
Definition: atlwin.h:946
#define TRAYCMD_HELP_AND_SUPPORT
Definition: undocshell.h:703
#define WS_THICKFRAME
Definition: pedump.c:630
LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2593
#define HTLEFT
Definition: winuser.h:2477
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define BM_SETSTATE
Definition: winuser.h:1913
int MapWindowPoints(HWND hWndTo, LPPOINT lpPoint, UINT nCount) const
Definition: atlwin.h:984
HWND m_RunFileDlgOwner
Definition: traywnd.cpp:501
#define ABE_TOP
Definition: shellapi.h:18
#define IN
Definition: typedefs.h:39
#define SW_NORMAL
Definition: winuser.h:763
#define DispatchMessage
Definition: winuser.h:5755
#define max(a, b)
Definition: svc.c:63
static DWORD WINAPI s_TrayPropertiesThread(IN OUT PVOID pParam)
Definition: traywnd.cpp:712
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define MFT_STRING
Definition: winuser.h:741
HDWP WINAPI BeginDeferWindowPos(_In_ int)
HIMAGELIST m_ImageList
Definition: traywnd.cpp:142
#define RB_SIZETORECT
Definition: commctrl.h:1598
#define PeekMessage
Definition: winuser.h:5820
WORD WINAPI TileWindows(_In_opt_ HWND hwndParent, _In_ UINT wHow, _In_opt_ CONST RECT *lpRect, _In_ UINT cKids, _In_reads_opt_(cKids) const HWND FAR *lpKids)
HWND SetFocus()
Definition: atlwin.h:1192
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define DFC_BUTTON
Definition: winuser.h:476
#define CloseHandle
Definition: compat.h:598
LRESULT HandleHotKey(DWORD id)
Definition: traywnd.cpp:853
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define AUTOHIDE_INTERVAL_ANIMATING
Definition: traywnd.cpp:36
BOOL PtInButton(POINT pt)
Definition: traywnd.cpp:358
#define MF_BYCOMMAND
Definition: winuser.h:202
LRESULT OnEnterSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2766
#define GW_CHILD
Definition: winuser.h:758
#define WC_BUTTON
Definition: commctrl.h:4625
#define SC_RESTORE
Definition: winuser.h:2588
long y
Definition: polytest.cpp:48
HRESULT STDMETHODCALLTYPE InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
Definition: traywnd.cpp:2419
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define ABN_WINDOWARRANGE
Definition: shellapi.h:72
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
LRESULT OnDisplayChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2582
#define ID_SHELL_CMD_PROPERTIES
Definition: resource.h:185
HRESULT hr
Definition: shlfolder.c:183
#define TWM_DOEXITWINDOWS
Definition: undocshell.h:56
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDHK_FIND_COMPUTER
Definition: traywnd.cpp:52
#define SM_CMONITORS
Definition: winuser.h:1034
LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2535
#define RGB(r, g, b)
Definition: precomp.h:62
void FitToRebar(PRECT pRect)
Definition: traywnd.cpp:1965
long x
Definition: polytest.cpp:48
#define IDHK_SYS_PROPERTIES
Definition: traywnd.cpp:55
VOID GetTrayRectFromScreenRect(IN DWORD Position, IN const RECT *pScreen, IN const SIZE *pTraySize OPTIONAL, OUT RECT *pRect)
Definition: traywnd.cpp:1309
DWORD WINAPI TrayPropertiesThread()
Definition: traywnd.cpp:683
HRESULT ShutdownShellServices(HDPA hdpa)
void SetFont(HFONT hFont, BOOL bRedraw=TRUE)
Definition: atlwin.h:1198
#define RBN_AUTOSIZE
Definition: commctrl.h:1631
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define WM_INITMENUPOPUP
Definition: winuser.h:1736
HRESULT STDMETHODCALLTYPE GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax)
Definition: traywnd.cpp:2427
#define AUTOHIDE_SPEED_SHOW
Definition: traywnd.cpp:38
UINT cxWindowBorders
Definition: winuser.h:3762
#define ID_SHELL_CMD_RESTORE_ALL
Definition: resource.h:197
#define ID_SHELL_CMD_UNDO_ACTION
Definition: resource.h:190
BOOL ShowWindowAsync(int nCmdShow)
Definition: atlwin.h:1333
#define WM_HOTKEY
Definition: winuser.h:1869
LRESULT OnMoving(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2697
#define AUTOHIDE_HIDDEN
Definition: traywnd.cpp:41
#define WM_NCCALCSIZE
Definition: winuser.h:1675
HWND Create(HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:1728
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2989
#define TPM_RETURNCMD
Definition: winuser.h:2377
HWND GetLastActivePopup() const
Definition: atlwin.h:670
#define BM_GETSTATE
Definition: winuser.h:1910
LRESULT HandleCommand(UINT uCommand)
Definition: traywnd.cpp:898
static COORD Position
Definition: mouse.c:34
#define ID_SHELL_CMD_OPEN_TASKMGR
Definition: resource.h:189
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
VOID ShowCustomizeNotifyIcons(HINSTANCE hInst, HWND hExplorer)
#define WARN(fmt,...)
Definition: debug.h:112
LRESULT OnNcLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2854
#define SIZE_RESTORED
Definition: winuser.h:2495
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
struct @1591 Msg[]
BOOL WINAPI SHRegGetBoolUSValueW(LPCWSTR pszSubKey, LPCWSTR pszValue, BOOL fIgnoreHKCU, BOOL fDefault)
Definition: reg.c:770
HRGN WINAPI CreateRectRgnIndirect(_In_ LPCRECT)
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:407
#define TNWM_GETMINIMUMSIZE
Definition: precomp.h:333
#define SHOW_DESKTOP_MINIMUM_WIDTH
static HDC
Definition: imagelist.c:92
void ProcessAutoHide()
Definition: traywnd.cpp:2098
#define CALLBACK
Definition: compat.h:35
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd)
Definition: atlwin.h:1998
CComPtr< IContextMenu > m_ContextMenu
Definition: traywnd.cpp:479
BOOL IsWindow() const
Definition: atlwin.h:941
#define ID_SHELL_CMD_SHOW_DESKTOP
Definition: resource.h:191
ush Pos
Definition: deflate.h:92
LRESULT OnNcLButtonDblClick(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3036
HWND hWnd
Definition: settings.c:17
DWORD IsDragging
Definition: traywnd.cpp:519
#define TIMER_ID_AUTOHIDE
Definition: traywnd.cpp:31
#define WM_QUIT
Definition: winuser.h:1613
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1282
LONG top
Definition: windef.h:307
#define AUTOHIDE_DELAY_SHOW
Definition: traywnd.cpp:35
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
static HRGN hRgn
Definition: mapping.c:33
HFONT m_Font
Definition: traywnd.cpp:482
CTrayShowDesktopButton m_ShowDesktopButton
Definition: traywnd.cpp:473
#define WM_EXITSIZEMOVE
Definition: winuser.h:1814
int DrawSizerWithTheme(IN HRGN hRgn)
Definition: traywnd.cpp:2235
IMenuPopup * CreateStartMenu(IN ITrayWindow *Tray, OUT IMenuBand **ppMenuBand, IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons)
Definition: startmnu.cpp:44
virtual HRESULT STDMETHODCALLTYPE GetTrayWindow(OUT HWND *phWndTray)
Definition: traywnd.cpp:3503
UINT cyWindowBorders
Definition: winuser.h:3763
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
LRESULT OnHotkey(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3104
#define ZeroMemory
Definition: winbase.h:1667
#define CS_HREDRAW
Definition: winuser.h:648
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LONG WINAPI GetMessageTime(void)
Definition: message.c:1361
#define GWL_EXSTYLE
Definition: winuser.h:845
#define SM_CXEDGE
Definition: winuser.h:1002
#define HWND_TOPMOST
Definition: winuser.h:1198
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:612
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
LRESULT OnExitSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2778
VOID RestoreAll()
Definition: traywnd.cpp:3178
#define IDHK_DESKTOP
Definition: traywnd.cpp:56
#define TRAYCMD_TILE_V
Definition: undocshell.h:693
LPWSTR dwTypeData
Definition: winuser.h:3259
static MONITORINFO mi
Definition: win.c:7338
DWORD GetDraggingRectFromPt(IN POINT pt, OUT RECT *pRect, OUT HMONITOR *phMonitor)
Definition: traywnd.cpp:1392
#define IDS_HELP_COMMAND
Definition: resource.h:102
#define ID_SHELL_CMD_CUST_NOTIF
Definition: resource.h:195
#define WM_NCHITTEST
Definition: winuser.h:1676
HMONITOR GetScreenRectFromRect(IN OUT RECT *pRect, IN DWORD dwFlags)
Definition: traywnd.cpp:1165
#define TRAYCMD_RESTORE_ALL
Definition: undocshell.h:698
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define VK_TAB
Definition: winuser.h:2189
#define IDHK_MINIMIZE_ALL
Definition: traywnd.cpp:47
void EndPaint(LPPAINTSTRUCT lpPaint)
Definition: atlwin.h:523
#define HTRIGHT
Definition: winuser.h:2479
#define WS_CHILD
Definition: pedump.c:617
#define VK_MENU
Definition: winuser.h:2194
#define AUTOHIDE_DELAY_HIDE
Definition: traywnd.cpp:34
#define TRAYCMD_TOGGLE_DESKTOP
Definition: undocshell.h:694
LONG left
Definition: windef.h:306
CComPtr< ITrayBandSite > m_TrayBandSite
Definition: traywnd.cpp:510
#define SWP_NOZORDER
Definition: winuser.h:1237
UINT uFlags
Definition: api.c:59
DWORD Flags
Definition: traywnd.cpp:514
void _Init()
Definition: traywnd.cpp:3543
DWORD m_Position
Definition: traywnd.cpp:491
static BOOL CALLBACK FindEffectiveProc(HWND hwnd, LPARAM lParam)
Definition: traywnd.cpp:71
char * LPSTR
Definition: xmlstorage.h:182
#define WS_CLIPCHILDREN
Definition: pedump.c:619
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
#define IDS_START
Definition: resource.h:23
#define SW_RESTORE
Definition: winuser.h:773
HMONITOR CalculateValidSize(IN DWORD Position, IN OUT RECT *pRect)
Definition: traywnd.cpp:1335
#define SetWindowStyle(hwnd, val)
Definition: utility.h:153
LONG right
Definition: windef.h:308
#define IDC_STARTBTN
Definition: resource.h:133
BOOL WINAPI IsIconic(_In_ HWND)
#define ABE_LEFT
Definition: shellapi.h:17
VOID CheckTrayWndPosition()
Definition: traywnd.cpp:1693
RECT rcMonitor
Definition: winuser.h:3775
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1329
#define TWM_GETTASKSWITCH
Definition: precomp.h:130
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2569
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
#define IDHK_RUN
Definition: traywnd.cpp:46
static BOOL IsThereAnyEffectiveWindow(BOOL bMustBeInMonitor)
Definition: traywnd.cpp:111
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
#define ID_SHELL_CMD_CASCADE_WND
Definition: resource.h:194
int32_t INT
Definition: typedefs.h:58
#define SWP_NOSENDCHANGING
Definition: winuser.h:1241
TW_STRUCKRECTS2 sr
Definition: precomp.h:209
LRESULT OnDoExitWindows(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3077
void appbar_notify_all(HMONITOR hMon, UINT uMsg, HWND hwndExclude, LPARAM lParam)
Definition: appbar.cpp:78
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
HWND STDMETHODCALLTYPE DisplayProperties()
Definition: traywnd.cpp:719
LRESULT DefWindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: atlwin.h:1606
HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow *TrayWnd, IN HWND hWndOwner, IContextMenu **ppCtxMenu)
LRESULT OnCtlColorBtn(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2639
#define TRAYCMD_SHOW_DESKTOP
Definition: undocshell.h:699
VOID OpenTaskManager(IN HWND hWndOwner)
Definition: traywnd.cpp:756
LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3087
#define WM_SETTINGCHANGE
Definition: winuser.h:1619
#define DCX_WINDOW
Definition: winuser.h:2103
#define CCS_VERT
Definition: commctrl.h:2249
HMONITOR m_PreviousMonitor
Definition: traywnd.cpp:493
#define TRAYCMD_SHOW_TASK_MGR
Definition: undocshell.h:700
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
LRESULT OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2734
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
virtual ~CTrayWindow()
Definition: traywnd.cpp:551
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:896
HWND m_DesktopWnd
Definition: traywnd.cpp:484
DWORD Position
Definition: precomp.h:198
DWORD InSizeMove
Definition: traywnd.cpp:518
UINT code
Definition: winuser.h:3149
#define WM_NCPAINT
Definition: winuser.h:1677
HWND m_Rebar
Definition: traywnd.cpp:485
BOOL STDMETHODCALLTYPE IsSpecialHWND(IN HWND hWnd)
Definition: traywnd.cpp:2338
VOID OnDraw(HDC hdc, LPRECT prc)
Definition: traywnd.cpp:429
LRESULT appbar_message(COPYDATASTRUCT *cds)
Definition: appbar.cpp:229
LRESULT EraseBackgroundWithTheme(HDC hdc)
Definition: traywnd.cpp:2219
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
BOOL IsChild(const HWND hWnd) const
Definition: atlwin.h:908
#define TPM_RIGHTBUTTON
Definition: winuser.h:2370
HWND hwndFound
Definition: traywnd.cpp:63
#define SM_CXSCREEN
Definition: winuser.h:953
HWND m_TrayNotify
Definition: traywnd.cpp:487
ULONG_PTR dwData
Definition: winuser.h:2991
#define IDM_TRAYWND
Definition: resource.h:57
HRESULT CTrayNotifyWnd_CreateInstance(HWND hwndParent, REFIID riid, void **ppv)
Definition: trayntfy.cpp:378
#define L(x)
Definition: ntvdm.h:50
LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2623
#define COLOR_3DFACE
Definition: winuser.h:923
LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:252
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
VOID DisplayTrayProperties(IN HWND hwndOwner, IN HWND hwndTaskbar)
Definition: trayprop.cpp:291
#define WM_CTLCOLORBTN
Definition: winuser.h:1759
VOID MakeTrayRectWithSize(IN DWORD Position, IN const SIZE *pTraySize, IN OUT RECT *pRect)
Definition: traywnd.cpp:1284
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HWND hwndProgman
Definition: traywnd.cpp:65
#define FALSE
Definition: types.h:117
HRESULT Tray_OnStartMenuDismissed(ITrayWindow *Tray)
Definition: traywnd.cpp:3715
#define WM_NCACTIVATE
Definition: winuser.h:1678
HWND Create(HWND hwndParent)
Definition: traywnd.cpp:221
GLenum const GLfloat * params
Definition: glext.h:5645
#define TWM_SETTINGSCHANGED
Definition: precomp.h:132
CSimpleArray< HWND > * pMinimizedAll
Definition: traywnd.cpp:3115
virtual HRESULT STDMETHODCALLTYPE InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
Definition: traywnd.cpp:3640
#define WC_STATIC
Definition: commctrl.h:4682
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LRESULT OnNcLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3046
TRACKMOUSEEVENT m_MouseTrackingInfo
Definition: traywnd.cpp:505
#define WM_NCRBUTTONUP
Definition: winuser.h:1686
short SHORT
Definition: pedump.c:59
static struct _test_info info[]
Definition: SetCursorPos.c:19
if SUCCEEDED(hr)
#define MDITILE_HORIZONTAL
Definition: winuser.h:2178
UINT_PTR SetTimer(UINT_PTR nIDEvent, UINT nElapse, void(CALLBACK *lpfnTimer)(HWND, UINT, UINT_PTR, DWORD)=NULL)
Definition: atlwin.h:1252
#define TRAYCMD_DATE_AND_TIME
Definition: undocshell.h:695
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
virtual ~CStartButton()
Definition: traywnd.cpp:155
#define CWP_SKIPINVISIBLE
Definition: winuser.h:208
void ProcessMouseTracking()
Definition: traywnd.cpp:2048
#define SM_CYDLGFRAME
Definition: winuser.h:962
BOOL STDMETHODCALLTYPE Lock(IN BOOL bLock)
Definition: traywnd.cpp:2349
#define TPM_TOPALIGN
Definition: winuser.h:2373
#define ShellExecute
Definition: shellapi.h:691
void UpdateFonts()
Definition: traywnd.cpp:1134
#define MOUSETRACK_INTERVAL
Definition: traywnd.cpp:33
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:535
#define TABDMC_NOTIFY
Definition: undocshell.h:714
static BOOL CALLBACK MinimizeWindowsProc(HWND hwnd, LPARAM lParam)
Definition: traywnd.cpp:3126
#define CWP_SKIPDISABLED
Definition: winuser.h:209
#define WM_SYSCHAR
Definition: winuser.h:1711
#define SS_LEFT
Definition: pedump.c:692
DWORD AutoHide
Definition: precomp.h:192
HRESULT STDMETHODCALLTYPE Open()
Definition: traywnd.cpp:2283
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
CSimpleArray< HWND > g_MinimizedAll
Definition: traywnd.cpp:131
#define CreateWindowEx
Definition: winuser.h:5745
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define TRANSPARENT
Definition: wingdi.h:950
BOOL KillTimer(UINT_PTR nIDEvent)
Definition: atlwin.h:970
#define S_FALSE
Definition: winerror.h:2357
BOOL WINAPI SHFindFiles(PCIDLIST_ABSOLUTE pidlFolder, PCIDLIST_ABSOLUTE pidlSaveFile)
Definition: shellord.c:2222
BOOL GetWindowRect(LPRECT lpRect) const
Definition: atlwin.h:810
VOID TrayProcessMessages(ITrayWindow *Tray)
Definition: traywnd.cpp:3721
#define VK_SHIFT
Definition: winuser.h:2192
#define WM_SIZING
Definition: winuser.h:1797
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL WINAPI SetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define TPM_BOTTOMALIGN
Definition: winuser.h:2375
CComPtr< IDeskBand > m_TaskBand
Definition: traywnd.cpp:478
VOID OpenCommonStartMenuDirectory(IN HWND hWndOwner, IN LPCTSTR lpOperation)
Definition: traywnd.cpp:738
#define TRAYCMD_SEARCH_FILES
Definition: undocshell.h:709
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
static HWND hwndParent
Definition: cryptui.c:300
#define SM_CYSIZEFRAME
Definition: winuser.h:989
HWND hwndDesktop
Definition: traywnd.cpp:64
#define ABE_RIGHT
Definition: shellapi.h:19
LONG cx
Definition: windef.h:334
#define TRAYCMD_MINIMIZE_ALL
Definition: undocshell.h:697
HRESULT CreateTrayWindow(ITrayWindow **ppTray)
Definition: traywnd.cpp:3700
LONG_PTR LPARAM
Definition: windef.h:208
#define SM_CYEDGE
Definition: winuser.h:1003
HWND m_TrayPropertiesOwner
Definition: traywnd.cpp:500
RECT m_TrayRects[4]
Definition: traywnd.cpp:497
#define TWM_OPENSTARTMENU
Definition: precomp.h:131
#define IDHK_HELP
Definition: traywnd.cpp:49
#define ID_SHELL_CMD_EXPLORE_ALL_USERS
Definition: resource.h:187
#define CSIDL_COMMON_STARTMENU
Definition: shlobj.h:2033
DWORD WINAPI RunFileDlgThread()
Definition: traywnd.cpp:624
#define TRAYCMD_PRINTERS_AND_FAXES
Definition: undocshell.h:706
PWINDOWPOS lppos
Definition: winuser.h:3589
HRESULT ExecResourceCmd(int id)
Definition: traywnd.cpp:582
UINT flags
Definition: winuser.h:3584
#define TIMER_ID_MOUSETRACK
Definition: traywnd.cpp:32
const char * LPCSTR
Definition: xmlstorage.h:183
RECT rcWindow
Definition: winuser.h:3757
BOOL IsPosHorizontal()
Definition: traywnd.cpp:1330
DWORD AlwaysOnTop
Definition: precomp.h:193
void WINAPI RunFileDlg(HWND hWndOwner, HICON hIcon, LPCWSTR lpstrDirectory, LPCWSTR lpstrTitle, LPCWSTR lpstrDescription, UINT uFlags)
Definition: dialogs.cpp:409
#define SHOW_DESKTOP_TIMER_INTERVAL
Definition: traywnd.cpp:370
#define IDM_SEARCH
Definition: resource.h:71
void DrawShowDesktopButton()
Definition: traywnd.cpp:2608
#define TRAYCMD_SEARCH_COMPUTERS
Definition: undocshell.h:710
CStartButton m_StartButton
Definition: traywnd.cpp:472
LRESULT OnRebarAutoSize(INT code, LPNMHDR nmhdr, BOOL &bHandled)
Definition: traywnd.cpp:3292
virtual ~CTrayWindowCtxMenu()
Definition: traywnd.cpp:3683
#define PtrToUlong(u)
Definition: config.h:107
#define GetMonitorInfo
Definition: winuser.h:5781
#define WM_DESTROY
Definition: winuser.h:1599
virtual HRESULT RaiseStartButton()
Definition: traywnd.cpp:3524
#define TRAYCMD_CUSTOMIZE_TASKBAR
Definition: undocshell.h:701
#define MIIM_ID
Definition: winuser.h:717
SHORT WINAPI GetKeyState(_In_ int)
#define SM_CXSIZEFRAME
Definition: winuser.h:987
#define MF_CHECKED
Definition: winuser.h:132
UINT m_AutoHideState
Definition: traywnd.cpp:503
#define TB_GETBUTTONSIZE
Definition: commctrl.h:1160
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:542
#define CS_VREDRAW
Definition: winuser.h:653
#define WM_COPYDATA
Definition: winuser.h:1654
#define SM_CYSCREEN
Definition: winuser.h:954
LRESULT OnSettingChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2555
virtual ULONG STDMETHODCALLTYPE GetState()
Definition: traywnd.cpp:3496
#define HWND_BOTTOM
Definition: winuser.h:1195
int SetWindowRgn(HRGN hRgn, BOOL bRedraw=FALSE)
Definition: atlwin.h:1288
#define TRACE(s)
Definition: solgame.cpp:4