ReactOS  0.4.15-dev-5608-gafb953a
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 
64 {
67 };
69 
71 {
72  WINDOWPOSBACKUPDATA wposdata;
73  HWND hDesk = GetDesktopWindow();
74  if (IsWindowVisible(hwnd) && !IsIconic(hwnd) && (hwnd != hDesk))
75  {
76  wposdata.hwnd = hwnd;
77  wposdata.wplt.length = sizeof(wposdata.wplt);
78  GetWindowPlacement(hwnd, &(wposdata.wplt));
79  g_WindowPosBackup.Add(wposdata);
80  }
81 
82  return TRUE;
83 }
84 
86 {
88 }
89 
91 {
93 
94  for (INT i = g_WindowPosBackup.GetSize() - 1; i >= 0; --i)
95  {
97  }
98 
99  g_WindowPosBackup.RemoveAll();
100 }
101 
103 {
109 };
110 
111 static BOOL CALLBACK
113 {
115 
116  if (!IsWindowVisible(hwnd) || IsIconic(hwnd))
117  return TRUE; // continue
118 
119  if (pei->hTrayWnd == hwnd || pei->hwndDesktop == hwnd ||
120  pei->hwndProgman == hwnd)
121  {
122  return TRUE; // continue
123  }
124 
125  if (pei->bMustBeInMonitor)
126  {
127  // is the window in the nearest monitor?
128  HMONITOR hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
129  if (hMon)
130  {
132  ZeroMemory(&info, sizeof(info));
133  info.cbSize = sizeof(info);
134  if (GetMonitorInfoW(hMon, &info))
135  {
136  RECT rcWindow, rcMonitor, rcIntersect;
137  rcMonitor = info.rcMonitor;
138 
139  GetWindowRect(hwnd, &rcWindow);
140 
141  if (!IntersectRect(&rcIntersect, &rcMonitor, &rcWindow))
142  return TRUE; // continue
143  }
144  }
145  }
146 
147  pei->hwndFound = hwnd;
148  return FALSE; // stop if found
149 }
150 
151 static BOOL
153 {
154  EFFECTIVE_INFO ei;
155  ei.hwndFound = NULL;
157  ei.hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
158  ei.hwndProgman = FindWindowW(L"Progman", NULL);
159  ei.bMustBeInMonitor = bMustBeInMonitor;
160 
162  if (ei.hwndFound && FALSE)
163  {
164  WCHAR szClass[64], szText[64];
165  GetClassNameW(ei.hwndFound, szClass, _countof(szClass));
166  GetWindowTextW(ei.hwndFound, szText, _countof(szText));
167  MessageBoxW(NULL, szText, szClass, 0);
168  }
169  return ei.hwndFound != NULL;
170 }
171 
173 
174 /*
175  * ITrayWindow
176  */
177 
178 const GUID IID_IShellDesktopTray = { 0x213e2df9, 0x9a14, 0x4328, { 0x99, 0xb1, 0x69, 0x61, 0xf9, 0x14, 0x3c, 0xe9 } };
179 
181  : public CWindowImpl<CStartButton>
182 {
186 
187 public:
189  : m_ImageList(NULL),
190  m_Font(NULL)
191  {
192  m_Size.cx = 0;
193  m_Size.cy = 0;
194  }
195 
196  virtual ~CStartButton()
197  {
198  if (m_ImageList != NULL)
200 
201  if (m_Font != NULL)
203  }
204 
206  {
207  return m_Size;
208  }
209 
211  {
212  SIZE Size = { 0, 0 };
213 
214  if (m_ImageList == NULL ||
216  {
218  }
219 
221 
222  /* Save the size of the start button */
223  m_Size = Size;
224  }
225 
227  {
228  /* Get the system fonts, we use the caption font, always bold, though. */
229  NONCLIENTMETRICS ncm = {sizeof(ncm)};
230  if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
231  return;
232 
233  if (m_Font)
235 
236  ncm.lfCaptionFont.lfWeight = FW_BOLD;
237  m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
238 
239  SetFont(m_Font, FALSE);
240  }
241 
243  {
244  // HACK & FIXME: CORE-18016
245  HWND hWnd = m_hWnd;
246  m_hWnd = NULL;
248 
249  SetWindowTheme(m_hWnd, L"Start", NULL);
250 
253  0, 0, 0,
254  IMAGE_BITMAP,
256 
259  UpdateSize();
260  }
261 
263  {
264  WCHAR szStartCaption[32];
266  IDS_START,
267  szStartCaption,
268  _countof(szStartCaption)))
269  {
270  wcscpy(szStartCaption, L"Start");
271  }
272 
274 
275  // HACK & FIXME: CORE-18016
277  0,
278  WC_BUTTON,
279  szStartCaption,
280  dwStyle,
281  0, 0, 0, 0,
282  hwndParent,
285  NULL);
286 
287  if (m_hWnd)
288  Initialize();
289 
290  return m_hWnd;
291  }
292 
294  {
295  if (uMsg == WM_KEYUP && wParam != VK_SPACE)
296  return 0;
297 
299  return 0;
300  }
301 
304  END_MSG_MAP()
305 
306 };
307 
308 // This window class name is CONFIRMED on Win10 by WinHier.
309 static const WCHAR szTrayShowDesktopButton[] = L"TrayShowDesktopButtonWClass";
310 
311 // The 'Show Desktop' button at edge of taskbar
313  public CWindowImpl<CTrayShowDesktopButton, CWindow, CControlWinTraits>
314 {
318 
319 public:
321 
323  {
324  }
325 
327  {
328 #define SHOW_DESKTOP_MINIMUM_WIDTH 3
329  INT cxy = 2 * ::GetSystemMetrics(SM_CXEDGE);
330  return max(cxy, SHOW_DESKTOP_MINIMUM_WIDTH);
331  }
332 
334  {
337  if (!m_hWnd)
338  return E_FAIL;
339 
340  ::SetWindowTheme(m_hWnd, L"TaskBar", NULL);
341  return S_OK;
342  }
343 
345  {
346  // The actual action can be delayed as an expected behaviour.
347  // But a too late action is an unexpected behaviour.
348  LONG nTime0 = m_nClickedTime;
349  LONG nTime1 = ::GetMessageTime();
350  if (nTime1 - nTime0 >= 600) // Ignore after 0.6 sec
351  return 0;
352 
353  // Show/Hide Desktop
355  return 0;
356  }
357 
358 #define TSDB_CLICK (WM_USER + 100)
359 
360  // This function is called from OnLButtonDown and parent.
362  {
363  // The actual action can be delayed as an expected behaviour.
365  PostMessage(TSDB_CLICK, 0, 0);
366  }
367 
369  {
370  Click(); // Left-click
371  return 0;
372  }
373 
375  {
376  if (m_hTheme)
378 
379  m_hTheme = ::OpenThemeData(m_hWnd, L"TaskBar");
381  return 0;
382  }
383 
384  // This function is called from OnPaint and parent.
386 
388  {
389  RECT rc;
390  GetClientRect(&rc);
391 
392  PAINTSTRUCT ps;
393  HDC hdc = BeginPaint(&ps);
394  OnDraw(hdc, &rc);
395  EndPaint(&ps);
396  return 0;
397  }
398 
400  {
401  if (!IsWindow())
402  return FALSE;
403  RECT rc;
404  GetWindowRect(&rc);
406  ::InflateRect(&rc, max(cxEdge, 1), max(cyEdge, 1));
407  return ::PtInRect(&rc, pt);
408  }
409 
410 #define SHOW_DESKTOP_TIMER_ID 999
411 #define SHOW_DESKTOP_TIMER_INTERVAL 200
412 
414  {
415  if (m_bHovering)
416  return;
417 
418  m_bHovering = TRUE;
422  }
423 
425  {
426  StartHovering();
427  return 0;
428  }
429 
431  {
433  return 0;
434 
435  POINT pt;
436  ::GetCursorPos(&pt);
437  if (!PtInButton(pt)) // The end of hovering?
438  {
439  m_bHovering = FALSE;
443  }
444 
445  return 0;
446  }
447 
449  {
450  if (m_hTheme)
451  {
453  m_hTheme = NULL;
454  }
455  return 0;
456  }
457 
461  MESSAGE_HANDLER(WM_THEMECHANGED, OnSettingChanged)
467  END_MSG_MAP()
468 };
469 
471 {
472  if (m_hTheme)
473  {
474  if (m_bHovering) // Draw a hot button
475  {
476  HTHEME hButtonTheme = ::OpenThemeData(m_hWnd, L"Button");
478  ::CloseThemeData(hButtonTheme);
479  }
480  else // Draw a taskbar background
481  {
483  }
484  }
485  else
486  {
487  RECT rc = *prc;
488  if (m_bHovering) // Draw a hot button
489  {
491  HBRUSH hbrHot = ::CreateSolidBrush(RGB(255, 255, 191));
492  ::FillRect(hdc, &rc, hbrHot);
493  ::DeleteObject(hbrHot);
494  }
495  else // Draw a flattish button
496  {
498  ::InflateRect(&rc, -1, -1);
500  }
501  }
502 }
503 
504 class CTrayWindow :
505  public CComCoClass<CTrayWindow>,
506  public CComObjectRootEx<CComMultiThreadModelNoCS>,
507  public CWindowImpl < CTrayWindow, CWindow, CControlWinTraits >,
508  public ITrayWindow,
509  public IShellDesktopTray,
510  public IOleWindow,
511  public IContextMenu
512 {
515 
518 
522 
524 
529 
531 
537 
540 
543 
547 
549 
550 public:
552 
553  union
554  {
556  struct
557  {
558  /* UI Status */
562  };
563  };
564 
565 public:
567  m_StartButton(),
569  m_Theme(NULL),
570  m_Font(NULL),
572  m_Rebar(NULL),
575  m_Position(0),
576  m_Monitor(NULL),
584  Flags(0)
585  {
587  ZeroMemory(&m_TraySize, sizeof(m_TraySize));
590  }
591 
592  virtual ~CTrayWindow()
593  {
594  if (m_ShellServices != NULL)
595  {
598  }
599 
600  if (m_Font != NULL)
601  {
603  m_Font = NULL;
604  }
605 
606  if (m_Theme)
607  {
609  m_Theme = NULL;
610  }
611 
612  PostQuitMessage(0);
613  }
614 
615 
616 
617 
618 
619  /**********************************************************
620  * ##### command handling #####
621  */
622 
624  {
625  WCHAR szCommand[256];
626  WCHAR *pszParameters;
627 
629  id,
630  szCommand,
631  _countof(szCommand)))
632  {
633  return E_FAIL;
634  }
635 
636  pszParameters = wcschr(szCommand, L'>');
637  if (pszParameters)
638  {
639  *pszParameters = 0;
640  pszParameters++;
641  }
642 
643  ShellExecuteW(m_hWnd, NULL, szCommand, pszParameters, NULL, SW_SHOWNORMAL);
644  return S_OK;
645  }
646 
648  {
649  /* Display the ReactOS Shutdown Dialog */
651 
652  /*
653  * If the user presses CTRL+ALT+SHIFT while exiting
654  * the shutdown dialog, exit the shell cleanly.
655  */
656  if ((GetKeyState(VK_CONTROL) & 0x8000) &&
657  (GetKeyState(VK_SHIFT) & 0x8000) &&
658  (GetKeyState(VK_MENU) & 0x8000))
659  {
660  PostMessage(WM_QUIT, 0, 0);
661  }
662  return 0;
663  }
664 
666  {
667  HWND hwnd;
668  RECT posRect;
669 
670  m_StartButton.GetWindowRect(&posRect);
671 
672  hwnd = CreateWindowEx(0,
673  WC_STATIC,
674  NULL,
676  posRect.left,
677  posRect.top,
678  posRect.right - posRect.left,
679  posRect.bottom - posRect.top,
680  NULL,
681  NULL,
682  NULL,
683  NULL);
684 
686 
687  // build the default directory from two environment variables
688  CStringW strDefaultDir, strHomePath;
689  strDefaultDir.GetEnvironmentVariable(L"HOMEDRIVE");
690  strHomePath.GetEnvironmentVariable(L"HOMEPATH");
691  strDefaultDir += strHomePath;
692 
693  RunFileDlg(hwnd, NULL, (LPCWSTR)strDefaultDir, NULL, NULL, RFF_CALCDIRECTORY);
694 
697 
698  return 0;
699  }
700 
702  {
703  CTrayWindow * This = (CTrayWindow*) pParam;
704  return This->RunFileDlgThread();
705  }
706 
708  {
709  HWND hRunDlg;
710  if (m_RunFileDlgOwner)
711  {
713  if (hRunDlg != NULL &&
714  hRunDlg != m_RunFileDlgOwner)
715  {
716  SetForegroundWindow(hRunDlg);
717  return;
718  }
719  }
720 
722  }
723 
725  {
726  HWND hwnd;
727  RECT posRect;
728 
729  m_StartButton.GetWindowRect(&posRect);
730  hwnd = CreateWindowEx(0,
731  WC_STATIC,
732  NULL,
734  posRect.left,
735  posRect.top,
736  posRect.right - posRect.left,
737  posRect.bottom - posRect.top,
738  NULL,
739  NULL,
740  NULL,
741  NULL);
742 
744 
746 
749 
750  return 0;
751  }
752 
754  {
755  CTrayWindow *This = (CTrayWindow*) pParam;
756 
757  return This->TrayPropertiesThread();
758  }
759 
761  {
762  HWND hTrayProp;
763 
765  {
767  if (hTrayProp != NULL &&
768  hTrayProp != m_TrayPropertiesOwner)
769  {
770  SetForegroundWindow(hTrayProp);
771  return NULL;
772  }
773  }
774 
776  return NULL;
777  }
778 
780  {
781  WCHAR szDir[MAX_PATH];
782 
783  if (SHGetSpecialFolderPath(hWndOwner,
784  szDir,
786  FALSE))
787  {
788  ShellExecute(hWndOwner,
789  lpOperation,
790  szDir,
791  NULL,
792  NULL,
793  SW_SHOWNORMAL);
794  }
795  }
796 
798  {
799  ShellExecute(hWndOwner,
800  TEXT("open"),
801  TEXT("taskmgr.exe"),
802  NULL,
803  NULL,
804  SW_SHOWNORMAL);
805  }
806 
808  {
810  {
811  ShowDesktop();
812  }
813  else
814  {
815  RestoreAll();
816  }
817  }
818 
820  {
821  switch (uiCmd)
822  {
825  break;
826 
829  TEXT("open"));
830  break;
831 
834  TEXT("explore"));
835  break;
836 
837  case ID_LOCKTASKBAR:
839  {
841  }
842  break;
843 
846  break;
847 
850  break;
851 
853  ShowDesktop();
854  break;
855 
858  if (g_Arrangement == NONE)
859  {
860  BackupWindowPos();
861  }
865  break;
866 
869  if (g_Arrangement == NONE)
870  {
871  BackupWindowPos();
872  }
876  break;
877 
880  if (g_Arrangement == NONE)
881  {
882  BackupWindowPos();
883  }
887  break;
888 
891  break;
892 
894  //FIXME: Use SHRunControlPanel
895  ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
896  break;
897 
899  RestoreAll();
900  break;
901 
902  default:
903  TRACE("ITrayWindow::ExecContextMenuCmd(%u): Unhandled Command ID!\n", uiCmd);
904  return FALSE;
905  }
906 
907  return TRUE;
908  }
909 
911  {
912  m_StartMenuPopup->OnSelect(MPOS_CANCELLEVEL);
913  }
914 
916  {
917  switch (id)
918  {
919  case IDHK_RUN:
920  HideStartMenu();
922  break;
923  case IDHK_HELP:
925  break;
926  case IDHK_EXPLORE:
927  //FIXME: We don't support this yet:
928  //ShellExecuteW(0, L"explore", NULL, NULL, NULL, 1);
929  ShellExecuteW(0, NULL, L"explorer.exe", L"/e ,", NULL, 1);
930  break;
931  case IDHK_FIND:
933  break;
934  case IDHK_FIND_COMPUTER:
936  break;
937  case IDHK_SYS_PROPERTIES:
938  //FIXME: Use SHRunControlPanel
939  ShellExecuteW(m_hWnd, NULL, L"sysdm.cpl", NULL, NULL, SW_NORMAL);
940  break;
941  case IDHK_NEXT_TASK:
942  break;
943  case IDHK_PREV_TASK:
944  break;
945  case IDHK_MINIMIZE_ALL:
946  MinimizeAll();
947  break;
948  case IDHK_RESTORE_ALL:
949  RestoreAll();
950  break;
951  case IDHK_DESKTOP:
952  ToggleDesktop();
953  break;
954  case IDHK_PAGER:
955  break;
956  }
957 
958  return 0;
959  }
960 
962  {
963  switch (uCommand)
964  {
965  case TRAYCMD_STARTMENU:
966  // TODO:
967  break;
968  case TRAYCMD_RUN_DIALOG:
969  HideStartMenu();
971  break;
973  LogoffWindowsDialog(m_hWnd); // FIXME: Maybe handle it in a similar way as DoExitWindows?
974  break;
975  case TRAYCMD_CASCADE:
977  break;
978  case TRAYCMD_TILE_H:
980  break;
981  case TRAYCMD_TILE_V:
983  break;
985  ToggleDesktop();
986  break;
988  ShellExecuteW(m_hWnd, NULL, L"timedate.cpl", NULL, NULL, SW_NORMAL);
989  break;
992  break;
994  MinimizeAll();
995  break;
996  case TRAYCMD_RESTORE_ALL:
997  RestoreAll();
998  break;
1000  ShowDesktop();
1001  break;
1002  case TRAYCMD_SHOW_TASK_MGR:
1004  break;
1006  break;
1007  case TRAYCMD_LOCK_TASKBAR:
1008  if (SHRestricted(REST_CLASSICSHELL) == 0)
1009  {
1011  }
1012  break;
1015  break;
1016  case TRAYCMD_CONTROL_PANEL:
1017  // TODO:
1018  break;
1020  DoExitWindows();
1021  break;
1023  // TODO:
1024  break;
1025  case TRAYCMD_LOCK_DESKTOP:
1026  // TODO:
1027  break;
1029  // TODO:
1030  break;
1031  case IDM_SEARCH:
1032  case TRAYCMD_SEARCH_FILES:
1033  SHFindFiles(NULL, NULL);
1034  break;
1037  break;
1038 
1039  default:
1040  break;
1041  }
1042 
1043  return FALSE;
1044  }
1045 
1046 
1048  IN HMENU hMenu,
1049  IN POINT *ppt OPTIONAL,
1050  IN HWND hwndExclude OPTIONAL,
1051  IN BOOL TrackUp,
1052  IN BOOL IsContextMenu)
1053  {
1054  TPMPARAMS tmp, *ptmp = NULL;
1055  POINT pt;
1056  UINT cmdId;
1057  UINT fuFlags;
1058 
1059  if (hwndExclude != NULL)
1060  {
1061  /* Get the client rectangle and map it to screen coordinates */
1062  if (::GetClientRect(hwndExclude,
1063  &tmp.rcExclude) &&
1064  ::MapWindowPoints(hwndExclude,
1065  NULL,
1066  (LPPOINT) &tmp.rcExclude,
1067  2) != 0)
1068  {
1069  ptmp = &tmp;
1070  }
1071  }
1072 
1073  if (ppt == NULL)
1074  {
1075  if (ptmp == NULL &&
1076  GetClientRect(&tmp.rcExclude) &&
1078  NULL,
1079  (LPPOINT) &tmp.rcExclude,
1080  2) != 0)
1081  {
1082  ptmp = &tmp;
1083  }
1084 
1085  if (ptmp != NULL)
1086  {
1087  /* NOTE: TrackPopupMenuEx will eventually align the track position
1088  for us, no need to take care of it here as long as the
1089  coordinates are somewhere within the exclusion rectangle */
1090  pt.x = ptmp->rcExclude.left;
1091  pt.y = ptmp->rcExclude.top;
1092  }
1093  else
1094  pt.x = pt.y = 0;
1095  }
1096  else
1097  pt = *ppt;
1098 
1099  tmp.cbSize = sizeof(tmp);
1100 
1101  fuFlags = TPM_RETURNCMD | TPM_VERTICAL;
1102  fuFlags |= (TrackUp ? TPM_BOTTOMALIGN : TPM_TOPALIGN);
1103  if (IsContextMenu)
1104  fuFlags |= TPM_RIGHTBUTTON;
1105  else
1106  fuFlags |= (TrackUp ? TPM_VERNEGANIMATION : TPM_VERPOSANIMATION);
1107 
1108  cmdId = TrackPopupMenuEx(hMenu,
1109  fuFlags,
1110  pt.x,
1111  pt.y,
1112  m_hWnd,
1113  ptmp);
1114 
1115  return cmdId;
1116  }
1117 
1119  IN IContextMenu * contextMenu,
1120  IN POINT *ppt OPTIONAL,
1121  IN HWND hwndExclude OPTIONAL,
1122  IN BOOL TrackUp,
1124  {
1125  POINT pt;
1126  TPMPARAMS params;
1127  RECT rc;
1128  HRESULT hr;
1129  UINT uCommand;
1130  HMENU popup = CreatePopupMenu();
1131 
1132  if (popup == NULL)
1133  return E_FAIL;
1134 
1135  if (ppt)
1136  {
1137  pt = *ppt;
1138  }
1139  else
1140  {
1141  ::GetWindowRect(m_hWnd, &rc);
1142  pt.x = rc.left;
1143  pt.y = rc.top;
1144  }
1145 
1146  TRACE("Before Query\n");
1147  hr = contextMenu->QueryContextMenu(popup, 0, 0, UINT_MAX, CMF_NORMAL);
1148  if (FAILED_UNEXPECTEDLY(hr))
1149  {
1150  TRACE("Query failed\n");
1151  DestroyMenu(popup);
1152  return hr;
1153  }
1154 
1155  TRACE("Before Tracking\n");
1157  if (hwndExclude)
1158  {
1159  ::GetWindowRect(hwndExclude, &rc);
1160  ZeroMemory(&params, sizeof(params));
1161  params.cbSize = sizeof(params);
1162  params.rcExclude = rc;
1163  uCommand = ::TrackPopupMenuEx(popup, TPM_RETURNCMD, pt.x, pt.y, m_hWnd, &params);
1164  }
1165  else
1166  {
1167  uCommand = ::TrackPopupMenuEx(popup, TPM_RETURNCMD, pt.x, pt.y, m_hWnd, NULL);
1168  }
1169  ::PostMessage(m_hWnd, WM_NULL, 0, 0);
1170 
1171  if (uCommand != 0)
1172  {
1173  TRACE("Before InvokeCommand\n");
1174  CMINVOKECOMMANDINFO cmi = { 0 };
1175  cmi.cbSize = sizeof(cmi);
1176  cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
1177  cmi.hwnd = m_hWnd;
1178  hr = contextMenu->InvokeCommand(&cmi);
1179  }
1180  else
1181  {
1182  TRACE("TrackPopupMenu failed. Code=%d, LastError=%d\n", uCommand, GetLastError());
1183  hr = S_FALSE;
1184  }
1185 
1186  DestroyMenu(popup);
1187  return hr;
1188  }
1189 
1190 
1191 
1192 
1193 
1194  /**********************************************************
1195  * ##### moving and sizing handling #####
1196  */
1197 
1199  {
1200  /* There is nothing to do if themes are enabled */
1201  if (m_Theme)
1202  return;
1203 
1205 
1206  NONCLIENTMETRICS ncm = {sizeof(ncm)};
1207  if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, FALSE))
1208  {
1209  ERR("SPI_GETNONCLIENTMETRICS failed\n");
1210  return;
1211  }
1212 
1213  if (m_Font != NULL)
1215 
1216  ncm.lfCaptionFont.lfWeight = FW_NORMAL;
1217  m_Font = CreateFontIndirect(&ncm.lfCaptionFont);
1218  if (!m_Font)
1219  {
1220  ERR("CreateFontIndirect failed\n");
1221  return;
1222  }
1223 
1227  }
1228 
1230  IN OUT RECT *pRect,
1231  IN DWORD dwFlags)
1232  {
1233  MONITORINFO mi;
1234  HMONITOR hMon;
1235 
1236  mi.cbSize = sizeof(mi);
1237  hMon = MonitorFromRect(pRect, dwFlags);
1238  if (hMon != NULL &&
1239  GetMonitorInfo(hMon, &mi))
1240  {
1241  *pRect = mi.rcMonitor;
1242  }
1243  else
1244  {
1245  pRect->left = 0;
1246  pRect->top = 0;
1247  pRect->right = GetSystemMetrics(SM_CXSCREEN);
1248  pRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1249 
1250  hMon = NULL;
1251  }
1252 
1253  return hMon;
1254  }
1255 
1257  IN const RECT *pRect)
1258  {
1259  HMONITOR hMon;
1260 
1261  /* In case the monitor sizes or saved sizes differ a bit (probably
1262  not a lot, only so the tray window overlaps into another monitor
1263  now), minimize the risk that we determine a wrong monitor by
1264  using the center point of the tray window if we can't determine
1265  it using the rectangle. */
1266  hMon = MonitorFromRect(pRect, MONITOR_DEFAULTTONULL);
1267  if (hMon == NULL)
1268  {
1269  POINT pt;
1270 
1271  pt.x = pRect->left + ((pRect->right - pRect->left) / 2);
1272  pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2);
1273 
1274  /* be less error-prone, find the nearest monitor */
1275  hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
1276  }
1277 
1278  return hMon;
1279  }
1280 
1282  IN HMONITOR hMonitor,
1283  IN OUT RECT *pRect)
1284  {
1285  HMONITOR hMon = NULL;
1286 
1287  if (hMonitor != NULL)
1288  {
1289  MONITORINFO mi;
1290 
1291  mi.cbSize = sizeof(mi);
1292  if (!GetMonitorInfo(hMonitor, &mi))
1293  {
1294  /* Hm, the monitor is gone? Try to find a monitor where it
1295  could be located now */
1296  hMon = GetMonitorFromRect(pRect);
1297  if (hMon == NULL ||
1298  !GetMonitorInfo(hMon, &mi))
1299  {
1300  hMon = NULL;
1301  goto GetPrimaryRect;
1302  }
1303  }
1304 
1305  *pRect = mi.rcMonitor;
1306  }
1307  else
1308  {
1309 GetPrimaryRect:
1310  pRect->left = 0;
1311  pRect->top = 0;
1312  pRect->right = GetSystemMetrics(SM_CXSCREEN);
1313  pRect->bottom = GetSystemMetrics(SM_CYSCREEN);
1314  }
1315 
1316  return hMon;
1317  }
1318 
1320  {
1322  SIZE size;
1323 
1324  if (pos > ABE_BOTTOM)
1325  pos = ABE_BOTTOM;
1326 
1327  HRESULT hr = GetThemePartSize(m_Theme, NULL, iSizerPart[pos], 0, NULL, TS_TRUE, &size);
1328  if (FAILED_UNEXPECTEDLY(hr))
1329  return;
1330 
1331  switch (pos)
1332  {
1333  case ABE_TOP:
1334  rc->bottom -= size.cy;
1335  break;
1336  case ABE_BOTTOM:
1337  rc->top += size.cy;
1338  break;
1339  case ABE_LEFT:
1340  rc->right -= size.cx;
1341  break;
1342  case ABE_RIGHT:
1343  rc->left += size.cx;
1344  break;
1345  }
1346  }
1347 
1349  IN const SIZE *pTraySize,
1350  IN OUT RECT *pRect)
1351  {
1352  switch (Position)
1353  {
1354  case ABE_LEFT:
1355  pRect->right = pRect->left + pTraySize->cx;
1356  break;
1357 
1358  case ABE_TOP:
1359  pRect->bottom = pRect->top + pTraySize->cy;
1360  break;
1361 
1362  case ABE_RIGHT:
1363  pRect->left = pRect->right - pTraySize->cx;
1364  break;
1365 
1366  case ABE_BOTTOM:
1367  default:
1368  pRect->top = pRect->bottom - pTraySize->cy;
1369  break;
1370  }
1371  }
1372 
1374  IN const RECT *pScreen,
1375  IN const SIZE *pTraySize OPTIONAL,
1376  OUT RECT *pRect)
1377  {
1378  if (pTraySize == NULL)
1379  pTraySize = &m_TraySize;
1380 
1381  *pRect = *pScreen;
1382 
1383  if(!m_Theme)
1384  {
1385  /* Move the border outside of the screen */
1386  InflateRect(pRect,
1389  }
1390 
1391  MakeTrayRectWithSize(Position, pTraySize, pRect);
1392  }
1393 
1395  {
1396  return m_Position == ABE_TOP || m_Position == ABE_BOTTOM;
1397  }
1398 
1400  IN DWORD Position,
1401  IN OUT RECT *pRect)
1402  {
1403  RECT rcScreen;
1404  //BOOL Horizontal;
1405  HMONITOR hMon;
1406  SIZE szMax, szWnd;
1407 
1408  //Horizontal = IsPosHorizontal();
1409 
1410  szWnd.cx = pRect->right - pRect->left;
1411  szWnd.cy = pRect->bottom - pRect->top;
1412 
1413  rcScreen = *pRect;
1414  hMon = GetScreenRectFromRect(
1415  &rcScreen,
1416  MONITOR_DEFAULTTONEAREST);
1417 
1418  /* Calculate the maximum size of the tray window and limit the window
1419  size to half of the screen's size. */
1420  szMax.cx = (rcScreen.right - rcScreen.left) / 2;
1421  szMax.cy = (rcScreen.bottom - rcScreen.top) / 2;
1422  if (szWnd.cx > szMax.cx)
1423  szWnd.cx = szMax.cx;
1424  if (szWnd.cy > szMax.cy)
1425  szWnd.cy = szMax.cy;
1426 
1427  /* FIXME - calculate */
1428 
1430  &rcScreen,
1431  &szWnd,
1432  pRect);
1433 
1434  return hMon;
1435  }
1436 
1437 #if 0
1438  VOID
1439  GetMinimumWindowSize(
1440  OUT RECT *pRect)
1441  {
1442  RECT rcMin = {0};
1443 
1444  AdjustWindowRectEx(&rcMin,
1446  GWL_STYLE),
1447  FALSE,
1449  GWL_EXSTYLE));
1450 
1451  *pRect = rcMin;
1452  }
1453 #endif
1454 
1455 
1457  IN POINT pt,
1458  OUT RECT *pRect,
1459  OUT HMONITOR *phMonitor)
1460  {
1461  HMONITOR hMon, hMonNew;
1462  DWORD PosH, PosV, Pos;
1463  SIZE DeltaPt, ScreenOffset;
1464  RECT rcScreen;
1465 
1466  rcScreen.left = 0;
1467  rcScreen.top = 0;
1468 
1469  /* Determine the screen rectangle */
1470  hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL);
1471  if (hMon != NULL)
1472  {
1473  MONITORINFO mi;
1474 
1475  mi.cbSize = sizeof(mi);
1476  if (!GetMonitorInfo(hMon, &mi))
1477  {
1478  hMon = NULL;
1479  goto GetPrimaryScreenRect;
1480  }
1481 
1482  /* make left top corner of the screen zero based to
1483  make calculations easier */
1484  pt.x -= mi.rcMonitor.left;
1485  pt.y -= mi.rcMonitor.top;
1486 
1487  ScreenOffset.cx = mi.rcMonitor.left;
1488  ScreenOffset.cy = mi.rcMonitor.top;
1489  rcScreen.right = mi.rcMonitor.right - mi.rcMonitor.left;
1490  rcScreen.bottom = mi.rcMonitor.bottom - mi.rcMonitor.top;
1491  }
1492  else
1493  {
1494 GetPrimaryScreenRect:
1495  ScreenOffset.cx = 0;
1496  ScreenOffset.cy = 0;
1497  rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
1498  rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
1499  }
1500 
1501  /* Calculate the nearest screen border */
1502  if (pt.x < rcScreen.right / 2)
1503  {
1504  DeltaPt.cx = pt.x;
1505  PosH = ABE_LEFT;
1506  }
1507  else
1508  {
1509  DeltaPt.cx = rcScreen.right - pt.x;
1510  PosH = ABE_RIGHT;
1511  }
1512 
1513  if (pt.y < rcScreen.bottom / 2)
1514  {
1515  DeltaPt.cy = pt.y;
1516  PosV = ABE_TOP;
1517  }
1518  else
1519  {
1520  DeltaPt.cy = rcScreen.bottom - pt.y;
1521  PosV = ABE_BOTTOM;
1522  }
1523 
1524  Pos = (DeltaPt.cx * rcScreen.bottom < DeltaPt.cy * rcScreen.right) ? PosH : PosV;
1525 
1526  /* Fix the screen origin to be relative to the primary monitor again */
1527  OffsetRect(&rcScreen,
1528  ScreenOffset.cx,
1529  ScreenOffset.cy);
1530 
1531  RECT rcPos = m_TrayRects[Pos];
1532 
1533  hMonNew = GetMonitorFromRect(&rcPos);
1534  if (hMon != hMonNew)
1535  {
1536  SIZE szTray;
1537 
1538  /* Recalculate the rectangle, we're dragging to another monitor.
1539  We don't need to recalculate the rect on single monitor systems. */
1540  szTray.cx = rcPos.right - rcPos.left;
1541  szTray.cy = rcPos.bottom - rcPos.top;
1542 
1543  GetTrayRectFromScreenRect(Pos, &rcScreen, &szTray, pRect);
1544  hMon = hMonNew;
1545  }
1546  else
1547  {
1548  /* The user is dragging the tray window on the same monitor. We don't need
1549  to recalculate the rectangle */
1550  *pRect = rcPos;
1551  }
1552 
1553  *phMonitor = hMon;
1554 
1555  return Pos;
1556  }
1557 
1559  IN OUT RECT *pRect,
1560  OUT HMONITOR *phMonitor)
1561  {
1562  POINT pt;
1563 
1564  /* Calculate the center of the rectangle. We call
1565  GetDraggingRectFromPt to calculate a valid
1566  dragging rectangle */
1567  pt.x = pRect->left + ((pRect->right - pRect->left) / 2);
1568  pt.y = pRect->top + ((pRect->bottom - pRect->top) / 2);
1569 
1570  return GetDraggingRectFromPt(
1571  pt,
1572  pRect,
1573  phMonitor);
1574  }
1575 
1577  {
1578  RECT rcTray;
1579 
1580  if (IsDragging)
1581  {
1582  rcTray.left = pwp->x;
1583  rcTray.top = pwp->y;
1584  rcTray.right = rcTray.left + pwp->cx;
1585  rcTray.bottom = rcTray.top + pwp->cy;
1586 
1587  if (!EqualRect(&rcTray,
1589  {
1590  /* Recalculate the rectangle, the user dragged the tray
1591  window to another monitor or the window was somehow else
1592  moved or resized */
1594  &rcTray,
1596  //m_TrayRects[DraggingPosition] = rcTray;
1597  }
1598 
1599  //Monitor = CalculateValidSize(DraggingPosition,
1600  // &rcTray);
1601 
1604  IsDragging = FALSE;
1605 
1606  m_TrayRects[m_Position] = rcTray;
1607  goto ChangePos;
1608  }
1609  else if (GetWindowRect(&rcTray))
1610  {
1611  if (InSizeMove)
1612  {
1613  if (!(pwp->flags & SWP_NOMOVE))
1614  {
1615  rcTray.left = pwp->x;
1616  rcTray.top = pwp->y;
1617  }
1618 
1619  if (!(pwp->flags & SWP_NOSIZE))
1620  {
1621  rcTray.right = rcTray.left + pwp->cx;
1622  rcTray.bottom = rcTray.top + pwp->cy;
1623  }
1624 
1626 
1627  if (!(pwp->flags & (SWP_NOMOVE | SWP_NOSIZE)))
1628  {
1629  SIZE szWnd;
1630 
1631  szWnd.cx = pwp->cx;
1632  szWnd.cy = pwp->cy;
1633 
1634  MakeTrayRectWithSize(m_Position, &szWnd, &rcTray);
1635  }
1636 
1637  m_TrayRects[m_Position] = rcTray;
1638  }
1639  else if (m_Position != (DWORD)-1)
1640  {
1641  /* If the user isn't resizing the tray window we need to make sure the
1642  new size or position is valid. this is to prevent changes to the window
1643  without user interaction. */
1644  rcTray = m_TrayRects[m_Position];
1645 
1647  {
1648  rcTray.left += m_AutoHideOffset.cx;
1649  rcTray.right += m_AutoHideOffset.cx;
1650  rcTray.top += m_AutoHideOffset.cy;
1651  rcTray.bottom += m_AutoHideOffset.cy;
1652  }
1653 
1654  }
1655 
1656 ChangePos:
1657  m_TraySize.cx = rcTray.right - rcTray.left;
1658  m_TraySize.cy = rcTray.bottom - rcTray.top;
1659 
1660  pwp->flags &= ~(SWP_NOMOVE | SWP_NOSIZE);
1661  pwp->x = rcTray.left;
1662  pwp->y = rcTray.top;
1663  pwp->cx = m_TraySize.cx;
1664  pwp->cy = m_TraySize.cy;
1665  }
1666  }
1667 
1669  {
1670  RECT rcClip, rcWindow;
1671  HRGN hClipRgn;
1672 
1673  if (GetWindowRect(&rcWindow))
1674  {
1675  /* Disable clipping on systems with only one monitor */
1676  if (GetSystemMetrics(SM_CMONITORS) <= 1)
1677  Clip = FALSE;
1678 
1679  if (Clip)
1680  {
1681  rcClip = rcWindow;
1682 
1683  GetScreenRect(m_Monitor, &rcClip);
1684 
1685  if (!IntersectRect(&rcClip, &rcClip, &rcWindow))
1686  {
1687  rcClip = rcWindow;
1688  }
1689 
1690  OffsetRect(&rcClip,
1691  -rcWindow.left,
1692  -rcWindow.top);
1693 
1694  hClipRgn = CreateRectRgnIndirect(&rcClip);
1695  }
1696  else
1697  hClipRgn = NULL;
1698 
1699  /* Set the clipping region or make sure the window isn't clipped
1700  by disabling it explicitly. */
1701  SetWindowRgn(hClipRgn, TRUE);
1702  }
1703  }
1704 
1706  {
1707 #if !WIN7_DEBUG_MODE
1708  RECT rcTray, rcWorkArea;
1709 
1710  /* If monitor has changed then fix the previous monitors work area */
1712  {
1713  GetScreenRect(m_PreviousMonitor, &rcWorkArea);
1714  SystemParametersInfoW(SPI_SETWORKAREA,
1715  1,
1716  &rcWorkArea,
1717  SPIF_SENDCHANGE);
1718  }
1719 
1720  rcTray = m_TrayRects[m_Position];
1721 
1722  GetScreenRect(m_Monitor, &rcWorkArea);
1724 
1725  /* If AutoHide is false then change the workarea to exclude
1726  the area that the taskbar covers. */
1728  {
1729  switch (m_Position)
1730  {
1731  case ABE_TOP:
1732  rcWorkArea.top = rcTray.bottom;
1733  break;
1734  case ABE_LEFT:
1735  rcWorkArea.left = rcTray.right;
1736  break;
1737  case ABE_RIGHT:
1738  rcWorkArea.right = rcTray.left;
1739  break;
1740  case ABE_BOTTOM:
1741  rcWorkArea.bottom = rcTray.top;
1742  break;
1743  }
1744  }
1745 
1746  /*
1747  * Resize the current monitor work area. Win32k will also send
1748  * a WM_SIZE message to automatically resize the desktop.
1749  */
1750  SystemParametersInfoW(SPI_SETWORKAREA,
1751  1,
1752  &rcWorkArea,
1753  SPIF_SENDCHANGE);
1754 #endif
1755  }
1756 
1758  {
1759  /* Force the rebar bands to resize */
1761  IID_IDeskBand,
1763  0,
1764  NULL,
1765  NULL);
1766 
1767  /* Calculate the size of the taskbar based on the rebar */
1769 
1770  /* Move the tray window */
1771  /* The handler of WM_WINDOWPOSCHANGING will override whatever size
1772  * and position we use here with m_TrayRects */
1773  SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE);
1774  ResizeWorkArea();
1776  }
1777 
1779  {
1780  DWORD Pos;
1781  RECT rcScreen;
1782  SIZE WndSize, EdgeSize, DlgFrameSize;
1783  SIZE StartBtnSize = m_StartButton.GetSize();
1784 
1785  EdgeSize.cx = GetSystemMetrics(SM_CXEDGE);
1786  EdgeSize.cy = GetSystemMetrics(SM_CYEDGE);
1787  DlgFrameSize.cx = GetSystemMetrics(SM_CXDLGFRAME);
1788  DlgFrameSize.cy = GetSystemMetrics(SM_CYDLGFRAME);
1789 
1791  rcScreen = g_TaskbarSettings.sr.Rect;
1792  GetScreenRectFromRect(&rcScreen, MONITOR_DEFAULTTONEAREST);
1793 
1795  {
1796  /* Use the minimum size of the taskbar, we'll use the start
1797  button as a minimum for now. Make sure we calculate the
1798  entire window size, not just the client size. However, we
1799  use a thinner border than a standard thick border, so that
1800  the start button and bands are not stuck to the screen border. */
1801  if(!m_Theme)
1802  {
1803  g_TaskbarSettings.sr.Size.cx = StartBtnSize.cx + (2 * (EdgeSize.cx + DlgFrameSize.cx));
1804  g_TaskbarSettings.sr.Size.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
1805  }
1806  else
1807  {
1808  g_TaskbarSettings.sr.Size.cx = StartBtnSize.cx - EdgeSize.cx;
1809  g_TaskbarSettings.sr.Size.cy = StartBtnSize.cy - EdgeSize.cy;
1812  }
1813  }
1814  /* Determine a minimum tray window rectangle. The "client" height is
1815  zero here since we cannot determine an optimal minimum width when
1816  loaded as a vertical tray window. We just need to make sure the values
1817  loaded from the registry are at least. The windows explorer behaves
1818  the same way, it allows the user to save a zero width vertical tray
1819  window, but not a zero height horizontal tray window. */
1820  if(!m_Theme)
1821  {
1822  WndSize.cx = 2 * (EdgeSize.cx + DlgFrameSize.cx);
1823  WndSize.cy = StartBtnSize.cy + (2 * (EdgeSize.cy + DlgFrameSize.cy));
1824  }
1825  else
1826  {
1827  WndSize.cx = StartBtnSize.cx;
1828  WndSize.cy = StartBtnSize.cy - EdgeSize.cy;
1829  }
1830 
1831  if (WndSize.cx < g_TaskbarSettings.sr.Size.cx)
1832  WndSize.cx = g_TaskbarSettings.sr.Size.cx;
1833  if (WndSize.cy < g_TaskbarSettings.sr.Size.cy)
1834  WndSize.cy = g_TaskbarSettings.sr.Size.cy;
1835 
1836  /* Save the calculated size */
1837  m_TraySize = WndSize;
1838 
1839  /* Calculate all docking rectangles. We need to do this here so they're
1840  initialized and dragging the tray window to another position gives
1841  usable results */
1842  for (Pos = ABE_LEFT; Pos <= ABE_BOTTOM; Pos++)
1843  {
1845  &rcScreen,
1846  &m_TraySize,
1847  &m_TrayRects[Pos]);
1848  // 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);
1849  }
1850 
1851  /* Determine which monitor we are on. It shouldn't matter which docked
1852  position rectangle we use */
1854  }
1855 
1857  {
1858  RECT rcClient;
1859  SIZE TraySize, StartSize;
1860  POINT ptTrayNotify = { 0, 0 };
1861  BOOL Horizontal;
1862  HDWP dwp;
1863 
1865  if (prcClient != NULL)
1866  {
1867  rcClient = *prcClient;
1868  }
1869  else
1870  {
1871  if (!GetClientRect(&rcClient))
1872  {
1873  ERR("Could not get client rect lastErr=%d\n", GetLastError());
1874  return;
1875  }
1876  }
1877 
1878  Horizontal = IsPosHorizontal();
1879 
1880  /* We're about to resize/move the start button, the rebar control and
1881  the tray notification control */
1882  dwp = BeginDeferWindowPos(4);
1883  if (dwp == NULL)
1884  {
1885  ERR("BeginDeferWindowPos failed. lastErr=%d\n", GetLastError());
1886  return;
1887  }
1888 
1889  /* Limit the Start button width to the client width, if necessary */
1890  StartSize = m_StartButton.GetSize();
1891  if (StartSize.cx > rcClient.right)
1892  StartSize.cx = rcClient.right;
1893 
1894  HWND hwndTaskToolbar = ::GetWindow(m_TaskSwitch, GW_CHILD);
1895  if (hwndTaskToolbar)
1896  {
1897  DWORD size = SendMessageW(hwndTaskToolbar, TB_GETBUTTONSIZE, 0, 0);
1898 
1899  /* Themed button covers Edge area as well */
1900  StartSize.cy = HIWORD(size) + (m_Theme ? GetSystemMetrics(SM_CYEDGE) : 0);
1901  }
1902 
1903  if (m_StartButton.m_hWnd != NULL)
1904  {
1905  /* Resize and reposition the button */
1906  dwp = m_StartButton.DeferWindowPos(dwp,
1907  NULL,
1908  0,
1909  0,
1910  StartSize.cx,
1911  StartSize.cy,
1913  if (dwp == NULL)
1914  {
1915  ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError());
1916  return;
1917  }
1918  }
1919 
1921  {
1922  // Get rectangle from rcClient
1923  RECT rc = rcClient;
1924  INT cxyShowDesktop = m_ShowDesktopButton.WidthOrHeight();
1925  if (Horizontal)
1926  {
1927  rc.left = rc.right - cxyShowDesktop;
1928  rc.right += 5; // excessive
1929  }
1930  else
1931  {
1932  rc.top = rc.bottom - cxyShowDesktop;
1933  rc.bottom += 5; // excessive
1934  }
1935 
1936  /* Resize and reposition the button */
1938  rc.left, rc.top,
1939  rc.right - rc.left, rc.bottom - rc.top,
1941 
1942  // Adjust rcClient
1943  if (Horizontal)
1944  rcClient.right -= cxyShowDesktop + ::GetSystemMetrics(SM_CXEDGE);
1945  else
1946  rcClient.bottom -= cxyShowDesktop + ::GetSystemMetrics(SM_CYEDGE);
1947  }
1948 
1949  /* Determine the size that the tray notification window needs */
1950  if (Horizontal)
1951  {
1952  TraySize.cx = 0;
1953  TraySize.cy = rcClient.bottom;
1954  }
1955  else
1956  {
1957  TraySize.cx = rcClient.right;
1958  TraySize.cy = 0;
1959  }
1960 
1961  if (m_TrayNotify != NULL &&
1964  (WPARAM)Horizontal,
1965  (LPARAM)&TraySize))
1966  {
1967  /* Move the tray notification window to the desired location */
1968  if (Horizontal)
1969  ptTrayNotify.x = rcClient.right - TraySize.cx;
1970  else
1971  ptTrayNotify.y = rcClient.bottom - TraySize.cy;
1972 
1973  dwp = ::DeferWindowPos(dwp,
1974  m_TrayNotify,
1975  NULL,
1976  ptTrayNotify.x,
1977  ptTrayNotify.y,
1978  TraySize.cx,
1979  TraySize.cy,
1981  if (dwp == NULL)
1982  {
1983  ERR("DeferWindowPos for notification area failed. lastErr=%d\n", GetLastError());
1984  return;
1985  }
1986  }
1987 
1988  /* Resize/Move the rebar control */
1989  if (m_Rebar != NULL)
1990  {
1991  POINT ptRebar = { 0, 0 };
1992  SIZE szRebar;
1993 
1994  SetWindowStyle(m_Rebar, CCS_VERT, Horizontal ? 0 : CCS_VERT);
1995 
1996  if (Horizontal)
1997  {
1998  ptRebar.x = StartSize.cx + GetSystemMetrics(SM_CXSIZEFRAME);
1999  szRebar.cx = ptTrayNotify.x - ptRebar.x;
2000  szRebar.cy = rcClient.bottom;
2001  }
2002  else
2003  {
2004  ptRebar.y = StartSize.cy + GetSystemMetrics(SM_CYSIZEFRAME);
2005  szRebar.cx = rcClient.right;
2006  szRebar.cy = ptTrayNotify.y - ptRebar.y;
2007  }
2008 
2009  dwp = ::DeferWindowPos(dwp,
2010  m_Rebar,
2011  NULL,
2012  ptRebar.x,
2013  ptRebar.y,
2014  szRebar.cx,
2015  szRebar.cy,
2017  }
2018 
2019  if (dwp != NULL)
2020  EndDeferWindowPos(dwp);
2021 
2022  if (m_TaskSwitch != NULL)
2023  {
2024  /* Update the task switch window configuration */
2026  }
2027  }
2028 
2029  void FitToRebar(PRECT pRect)
2030  {
2031  /* Get the rect of the rebar */
2032  RECT rebarRect, taskbarRect, clientRect;
2033  ::GetWindowRect(m_Rebar, &rebarRect);
2034  ::GetWindowRect(m_hWnd, &taskbarRect);
2035  ::GetClientRect(m_hWnd, &clientRect);
2036  OffsetRect(&rebarRect, -taskbarRect.left, -taskbarRect.top);
2037 
2038  /* Calculate the difference of size of the taskbar and the rebar */
2039  SIZE margins;
2040  margins.cx = taskbarRect.right - taskbarRect.left - clientRect.right + clientRect.left;
2041  margins.cy = taskbarRect.bottom - taskbarRect.top - clientRect.bottom + clientRect.top;
2042 
2043  /* Calculate the new size of the rebar and make it resize, then change the new taskbar size */
2044  switch (m_Position)
2045  {
2046  case ABE_TOP:
2047  rebarRect.bottom = rebarRect.top + pRect->bottom - pRect->top - margins.cy;
2049  pRect->bottom = pRect->top + rebarRect.bottom - rebarRect.top + margins.cy;
2050  break;
2051  case ABE_BOTTOM:
2052  rebarRect.top = rebarRect.bottom - (pRect->bottom - pRect->top - margins.cy);
2054  pRect->top = pRect->bottom - (rebarRect.bottom - rebarRect.top + margins.cy);
2055  break;
2056  case ABE_LEFT:
2057  rebarRect.right = rebarRect.left + (pRect->right - pRect->left - margins.cx);
2059  pRect->right = pRect->left + (rebarRect.right - rebarRect.left + margins.cx);
2060  break;
2061  case ABE_RIGHT:
2062  rebarRect.left = rebarRect.right - (pRect->right - pRect->left - margins.cx);
2064  pRect->left = pRect->right - (rebarRect.right - rebarRect.left + margins.cx);
2065  break;
2066  }
2067 
2069  }
2070 
2072  {
2073  if (m_StartMenuPopup != NULL)
2074  {
2075  POINTL pt;
2076  RECTL rcExclude;
2077  DWORD dwFlags = 0;
2078 
2079  if (m_StartButton.GetWindowRect((RECT*) &rcExclude))
2080  {
2081  switch (m_Position)
2082  {
2083  case ABE_BOTTOM:
2084  pt.x = rcExclude.left;
2085  pt.y = rcExclude.top;
2086  dwFlags |= MPPF_TOP;
2087  break;
2088  case ABE_TOP:
2089  pt.x = rcExclude.left;
2090  pt.y = rcExclude.bottom;
2091  dwFlags |= MPPF_BOTTOM;
2092  break;
2093  case ABE_LEFT:
2094  pt.x = rcExclude.right;
2095  pt.y = rcExclude.top;
2096  dwFlags |= MPPF_RIGHT;
2097  break;
2098  case ABE_RIGHT:
2099  pt.x = rcExclude.left;
2100  pt.y = rcExclude.top;
2101  dwFlags |= MPPF_LEFT;
2102  break;
2103  }
2104 
2105  m_StartMenuPopup->Popup(&pt, &rcExclude, dwFlags);
2106 
2107  m_StartButton.SendMessageW(BM_SETSTATE, TRUE, 0);
2108  }
2109  }
2110  }
2111 
2113  {
2114  RECT rcCurrent;
2115  POINT pt;
2116  BOOL over;
2118 
2119  GetCursorPos(&pt);
2120  GetWindowRect(&rcCurrent);
2121  over = PtInRect(&rcCurrent, pt);
2122 
2124  {
2125  over = TRUE;
2126  }
2127 
2128  if (over)
2129  {
2130  if (state == AUTOHIDE_HIDING)
2131  {
2132  TRACE("AutoHide cancelling hide.\n");
2135  }
2136  else if (state == AUTOHIDE_HIDDEN)
2137  {
2138  TRACE("AutoHide starting show.\n");
2141  }
2142  }
2143  else
2144  {
2145  if (state == AUTOHIDE_SHOWING)
2146  {
2147  TRACE("AutoHide cancelling show.\n");
2150  }
2151  else if (state == AUTOHIDE_SHOWN)
2152  {
2153  TRACE("AutoHide starting hide.\n");
2156  }
2157 
2159  }
2160  }
2161 
2163  {
2166 
2167  switch (m_AutoHideState)
2168  {
2169  case AUTOHIDE_HIDING:
2170  switch (m_Position)
2171  {
2172  case ABE_LEFT:
2173  m_AutoHideOffset.cy = 0;
2175  if (m_AutoHideOffset.cx < -w)
2176  m_AutoHideOffset.cx = w;
2177  break;
2178  case ABE_TOP:
2179  m_AutoHideOffset.cx = 0;
2181  if (m_AutoHideOffset.cy < -h)
2182  m_AutoHideOffset.cy = h;
2183  break;
2184  case ABE_RIGHT:
2185  m_AutoHideOffset.cy = 0;
2187  if (m_AutoHideOffset.cx > w)
2188  m_AutoHideOffset.cx = w;
2189  break;
2190  case ABE_BOTTOM:
2191  m_AutoHideOffset.cx = 0;
2193  if (m_AutoHideOffset.cy > h)
2194  m_AutoHideOffset.cy = h;
2195  break;
2196  }
2197 
2198  if (m_AutoHideOffset.cx != w && m_AutoHideOffset.cy != h)
2199  {
2201  break;
2202  }
2203 
2204  /* fallthrough */
2205  case AUTOHIDE_HIDDEN:
2206 
2207  switch (m_Position)
2208  {
2209  case ABE_LEFT:
2210  m_AutoHideOffset.cx = -w;
2211  m_AutoHideOffset.cy = 0;
2212  break;
2213  case ABE_TOP:
2214  m_AutoHideOffset.cx = 0;
2215  m_AutoHideOffset.cy = -h;
2216  break;
2217  case ABE_RIGHT:
2218  m_AutoHideOffset.cx = w;
2219  m_AutoHideOffset.cy = 0;
2220  break;
2221  case ABE_BOTTOM:
2222  m_AutoHideOffset.cx = 0;
2223  m_AutoHideOffset.cy = h;
2224  break;
2225  }
2226 
2229  break;
2230 
2231  case AUTOHIDE_SHOWING:
2233  {
2235  }
2237  {
2239  }
2240  else
2241  {
2242  m_AutoHideOffset.cx = 0;
2243  }
2244 
2246  {
2248  }
2250  {
2252  }
2253  else
2254  {
2255  m_AutoHideOffset.cy = 0;
2256  }
2257 
2258  if (m_AutoHideOffset.cx != 0 || m_AutoHideOffset.cy != 0)
2259  {
2261  break;
2262  }
2263 
2264  /* fallthrough */
2265  case AUTOHIDE_SHOWN:
2266 
2269  break;
2270  }
2271 
2272  SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER);
2273  }
2274 
2275 
2276 
2277 
2278 
2279  /**********************************************************
2280  * ##### taskbar drawing #####
2281  */
2282 
2284  {
2285  RECT rect;
2287 
2289 
2290  if (m_Theme)
2291  {
2292  GetClientRect(&rect);
2293  DrawThemeBackground(m_Theme, hdc, iSBkgndPart[m_Position], 0, &rect, 0);
2294  }
2295 
2296  return 0;
2297  }
2298 
2300  {
2301  HDC hdc;
2302  RECT rect;
2304  SIZE size;
2305 
2307 
2308  HRESULT hr = GetThemePartSize(m_Theme, NULL, iSizerPart[m_Position], 0, NULL, TS_TRUE, &size);
2309  if (FAILED_UNEXPECTEDLY(hr))
2310  return 0;
2311 
2312  GetWindowRect(&rect);
2313  OffsetRect(&rect, -rect.left, -rect.top);
2314 
2315  hdc = GetWindowDC();
2316 
2317  switch (m_Position)
2318  {
2319  case ABE_LEFT:
2320  rect.left = rect.right - size.cx;
2321  break;
2322  case ABE_TOP:
2323  rect.top = rect.bottom - size.cy;
2324  break;
2325  case ABE_RIGHT:
2326  rect.right = rect.left + size.cx;
2327  break;
2328  case ABE_BOTTOM:
2329  default:
2330  rect.bottom = rect.top + size.cy;
2331  break;
2332  }
2333 
2334  DrawThemeBackground(m_Theme, hdc, iSizerPart[m_Position], 0, &rect, 0);
2335 
2336  ReleaseDC(hdc);
2337  return 0;
2338  }
2339 
2340 
2341 
2342 
2343 
2344  /*
2345  * ITrayWindow
2346  */
2348  {
2349  RECT rcWnd;
2350 
2351  /* Check if there's already a window created and try to show it.
2352  If it was somehow destroyed just create a new tray window. */
2353  if (m_hWnd != NULL && IsWindow())
2354  {
2355  return S_OK;
2356  }
2357 
2358  DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE;
2360  dwExStyle |= WS_EX_TOPMOST;
2361 
2363  if(!m_Theme)
2364  {
2365  dwStyle |= WS_THICKFRAME | WS_BORDER;
2366  }
2367 
2368  ZeroMemory(&rcWnd, sizeof(rcWnd));
2369  if (m_Position != (DWORD) -1)
2370  rcWnd = m_TrayRects[m_Position];
2371 
2372  if (!Create(NULL, rcWnd, NULL, dwStyle, dwExStyle))
2373  return E_FAIL;
2374 
2375  /* Align all controls on the tray window */
2377 
2378  /* Move the tray window to the right position and resize it if necessary */
2380 
2381  return S_OK;
2382  }
2383 
2385  {
2386  if (m_hWnd != NULL)
2387  {
2390  0,
2391  0);
2392  }
2393 
2394  return S_OK;
2395  }
2396 
2398  {
2399  return m_hWnd;
2400  }
2401 
2403  {
2404  return (m_hWnd == hWnd ||
2405  (m_DesktopWnd != NULL && m_hWnd == m_DesktopWnd));
2406  }
2407 
2409  {
2410  return IsPosHorizontal();
2411  }
2412 
2414  {
2415  BOOL bPrevLock = g_TaskbarSettings.bLock;
2416 
2417  if (g_TaskbarSettings.bLock != bLock)
2418  {
2419  g_TaskbarSettings.bLock = bLock;
2420 
2421  if (m_TrayBandSite != NULL)
2422  {
2423  if (!SUCCEEDED(m_TrayBandSite->Lock(bLock)))
2424  {
2425  /* Reset?? */
2426  g_TaskbarSettings.bLock = bPrevLock;
2427  return bPrevLock;
2428  }
2429  }
2430 
2431  if (m_Theme)
2432  {
2433  /* Update cached tray sizes */
2434  for(DWORD Pos = ABE_LEFT; Pos <= ABE_BOTTOM; Pos++)
2435  {
2436  RECT rcGripper = {0};
2437  AdjustSizerRect(&rcGripper, Pos);
2438 
2440  {
2441  m_TrayRects[Pos].top += rcGripper.top;
2442  m_TrayRects[Pos].left += rcGripper.left;
2443  m_TrayRects[Pos].bottom += rcGripper.bottom;
2444  m_TrayRects[Pos].right += rcGripper.right;
2445  }
2446  else
2447  {
2448  m_TrayRects[Pos].top -= rcGripper.top;
2449  m_TrayRects[Pos].left -= rcGripper.left;
2450  m_TrayRects[Pos].bottom -= rcGripper.bottom;
2451  m_TrayRects[Pos].right -= rcGripper.right;
2452  }
2453  }
2454  }
2456  ResizeWorkArea();
2458  }
2459 
2460  return bPrevLock;
2461  }
2462 
2463 
2464  /*
2465  * IContextMenu
2466  */
2468  UINT indexMenu,
2469  UINT idCmdFirst,
2470  UINT idCmdLast,
2471  UINT uFlags)
2472  {
2473  if (!m_ContextMenu)
2474  {
2476  if (FAILED_UNEXPECTEDLY(hr))
2477  return hr;
2478  }
2479 
2480  return m_ContextMenu->QueryContextMenu(hPopup, indexMenu, idCmdFirst, idCmdLast, uFlags);
2481  }
2482 
2484  {
2485  if (!m_ContextMenu)
2486  return E_INVALIDARG;
2487 
2488  return m_ContextMenu->InvokeCommand(lpici);
2489  }
2490 
2492  UINT uType,
2493  UINT *pwReserved,
2494  LPSTR pszName,
2495  UINT cchMax)
2496  {
2497  if (!m_ContextMenu)
2498  return E_INVALIDARG;
2499 
2500  return m_ContextMenu->GetCommandString(idCmd, uType, pwReserved, pszName, cchMax);
2501  }
2502 
2503  BOOL IsShowDesktopButtonNeeded() // Read the registry value
2504  {
2505  return SHRegGetBoolUSValueW(
2506  L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
2507  L"TaskbarSd",
2508  FALSE,
2509  TRUE);
2510  }
2511 
2512  /**********************************************************
2513  * ##### message handling #####
2514  */
2515 
2517  {
2518  HRESULT hRet;
2519 
2520  ((ITrayWindow*)this)->AddRef();
2521 
2522  SetWindowTheme(m_hWnd, L"TaskBar", NULL);
2523 
2524  /* Create the Start button */
2526 
2527  /* Create the 'Show Desktop' button if necessary */
2530 
2531  /* Load the saved tray window settings */
2532  RegLoadSettings();
2533 
2534  /* Create and initialize the start menu */
2536  m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0);
2537 
2538  /* Create the task band */
2540  if (FAILED_UNEXPECTEDLY(hRet))
2541  return FALSE;
2542 
2543  /* Create the rebar band site. This actually creates the rebar and the tasks toolbar. */
2545  if (FAILED_UNEXPECTEDLY(hRet))
2546  return FALSE;
2547 
2548  /* Create the tray notification window */
2550  if (FAILED_UNEXPECTEDLY(hRet))
2551  return FALSE;
2552 
2553  /* Get the hwnd of the rebar */
2555  if (FAILED_UNEXPECTEDLY(hRet))
2556  return FALSE;
2557 
2558  /* Get the hwnd of the tasks toolbar */
2560  if (FAILED_UNEXPECTEDLY(hRet))
2561  return FALSE;
2562 
2563  /* Get the hwnd of the tray notification window */
2565  if (FAILED_UNEXPECTEDLY(hRet))
2566  return FALSE;
2567 
2568  SetWindowTheme(m_Rebar, L"TaskBar", NULL);
2569 
2570  UpdateFonts();
2571 
2573 
2575  {
2578  }
2579 
2580  /* Set the initial lock state in the band site */
2582 
2595 
2596  return TRUE;
2597  }
2598 
2600  {
2601  if (m_Theme)
2603 
2604  m_Theme = OpenThemeData(m_hWnd, L"TaskBar");
2605 
2606  if (m_Theme)
2607  {
2609  }
2610  else
2611  {
2613  }
2615 
2616  return TRUE;
2617  }
2618 
2620  {
2621  if (wParam == SPI_SETNONCLIENTMETRICS)
2622  {
2625  UpdateFonts();
2628  }
2629 
2630  return 0;
2631  }
2632 
2634  {
2635  HDC hdc = (HDC) wParam;
2636 
2637  if (!m_Theme)
2638  {
2639  bHandled = FALSE;
2640  return 0;
2641  }
2642 
2643  return EraseBackgroundWithTheme(hdc);
2644  }
2645 
2647  {
2648  /* Load the saved tray window settings */
2649  RegLoadSettings();
2650 
2651  /* Move the tray window to the right position and resize it if necessary */
2653 
2654  return TRUE;
2655  }
2656 
2658  {
2659  COPYDATASTRUCT *pCopyData = reinterpret_cast<COPYDATASTRUCT *>(lParam);
2660  switch (pCopyData->dwData)
2661  {
2662  case TABDMC_APPBAR:
2663  return appbar_message(pCopyData);
2664  case TABDMC_NOTIFY:
2665  case TABDMC_LOADINPROC:
2667  }
2668  return FALSE;
2669  }
2670 
2671  // We have to draw non-client area because the 'Show Desktop' button is beyond client area.
2673  {
2675  return;
2676  // Get the rectangle in window coordinates
2677  RECT rcButton, rcWnd;
2678  GetWindowRect(&rcWnd);
2680  ::OffsetRect(&rcButton, -rcWnd.left, -rcWnd.top);
2681 
2683  m_ShowDesktopButton.OnDraw(hdc, &rcButton); // Draw the button
2684  ReleaseDC(hdc);
2685  }
2686 
2688  {
2689  DefWindowProc(uMsg, wParam, lParam);
2690  bHandled = TRUE;
2691 
2693  {
2694  DrawShowDesktopButton(); // We have to draw non-client area
2695  return 0;
2696  }
2697 
2698  DrawSizerWithTheme((HRGN) wParam);
2699  DrawShowDesktopButton(); // We have to draw non-client area
2700  return 0;
2701  }
2702 
2704  {
2707  }
2708 
2710  {
2711  RECT rcClient;
2712  POINT pt;
2713 
2715  {
2716  /* The user may not be able to resize the tray window.
2717  Pretend like the window is not sizeable when the user
2718  clicks on the border. */
2719  return HTBORDER;
2720  }
2721 
2723  if (GetClientRect(&rcClient) &&
2724  (MapWindowPoints(NULL, (LPPOINT) &rcClient, 2) != 0 || GetLastError() == ERROR_SUCCESS))
2725  {
2726  pt.x = (SHORT) LOWORD(lParam);
2727  pt.y = (SHORT) HIWORD(lParam);
2728 
2729  if (PtInRect(&rcClient, pt))
2730  {
2731  /* The user is trying to drag the tray window */
2732  return HTCAPTION;
2733  }
2734 
2735  /* Depending on the position of the tray window, allow only
2736  changing the border next to the monitor working area */
2737  switch (m_Position)
2738  {
2739  case ABE_TOP:
2740  if (pt.y > rcClient.bottom)
2741  return HTBOTTOM;
2742  break;
2743  case ABE_LEFT:
2744  if (pt.x > rcClient.right)
2745  return HTRIGHT;
2746  break;
2747  case ABE_RIGHT:
2748  if (pt.x < rcClient.left)
2749  return HTLEFT;
2750  break;
2751  case ABE_BOTTOM:
2752  default:
2753  if (pt.y < rcClient.top)
2754  return HTTOP;
2755  break;
2756  }
2757  }
2758  return HTBORDER;
2759  }
2760 
2762  {
2763  POINT ptCursor;
2764  PRECT pRect = (PRECT) lParam;
2765 
2766  /* We need to ensure that an application can not accidently
2767  move the tray window (using SetWindowPos). However, we still
2768  need to be able to move the window in case the user wants to
2769  drag the tray window to another position or in case the user
2770  wants to resize the tray window. */
2771  if (!g_TaskbarSettings.bLock && GetCursorPos(&ptCursor))
2772  {
2773  IsDragging = TRUE;
2775  }
2776  else
2777  {
2778  *pRect = m_TrayRects[m_Position];
2779  }
2780  return TRUE;
2781  }
2782 
2784  {
2785  PRECT pRect = (PRECT) lParam;
2786 
2787  if (!g_TaskbarSettings.bLock)
2788  {
2789  FitToRebar(pRect);
2790  }
2791  else
2792  {
2793  *pRect = m_TrayRects[m_Position];
2794  }
2795  return TRUE;
2796  }
2797 
2799  {
2801  return TRUE;
2802  }
2803 
2805  {
2806  RECT rcClient;
2807  if (wParam == SIZE_RESTORED && lParam == 0)
2808  {
2809  ResizeWorkArea();
2810  /* Clip the tray window on multi monitor systems so the edges can't
2811  overlap into another monitor */
2813 
2814  if (!GetClientRect(&rcClient))
2815  {
2816  return FALSE;
2817  }
2818  }
2819  else
2820  {
2821  rcClient.left = rcClient.top = 0;
2822  rcClient.right = LOWORD(lParam);
2823  rcClient.bottom = HIWORD(lParam);
2824  }
2825 
2826  AlignControls(&rcClient);
2827  return TRUE;
2828  }
2829 
2831  {
2832  InSizeMove = TRUE;
2833  IsDragging = FALSE;
2834  if (!g_TaskbarSettings.bLock)
2835  {
2836  /* Remove the clipping on multi monitor systems while dragging around */
2838  }
2839  return TRUE;
2840  }
2841 
2843  {
2844  InSizeMove = FALSE;
2845  if (!g_TaskbarSettings.bLock)
2846  {
2848 
2849  /* Apply clipping */
2851  }
2852  return TRUE;
2853  }
2854 
2856  {
2857  switch (wParam)
2858  {
2859  case TEXT(' '):
2860  {
2861  /* The user pressed Alt+Space, this usually brings up the system menu of a window.
2862  The tray window needs to handle this specially, since it normally doesn't have
2863  a system menu. */
2864 
2865  static const UINT uidDisableItem [] = {
2866  SC_RESTORE,
2867  SC_MOVE,
2868  SC_SIZE,
2869  SC_MAXIMIZE,
2870  SC_MINIMIZE,
2871  };
2872  HMENU hSysMenu;
2873  UINT i, uId;
2874 
2875  /* temporarily enable the system menu */
2877 
2878  hSysMenu = GetSystemMenu(FALSE);
2879  if (hSysMenu != NULL)
2880  {
2881  /* Disable all items that are not relevant */
2882  for (i = 0; i < _countof(uidDisableItem); i++)
2883  {
2884  EnableMenuItem(hSysMenu,
2885  uidDisableItem[i],
2887  }
2888 
2889  EnableMenuItem(hSysMenu,
2890  SC_CLOSE,
2891  MF_BYCOMMAND |
2893 
2894  /* Display the system menu */
2895  uId = TrackMenu(
2896  hSysMenu,
2897  NULL,
2899  m_Position != ABE_TOP,
2900  FALSE);
2901  if (uId != 0)
2902  {
2903  SendMessage(m_hWnd, WM_SYSCOMMAND, (WPARAM) uId, 0);
2904  }
2905  }
2906 
2907  /* revert the system menu window style */
2909  break;
2910  }
2911 
2912  default:
2913  bHandled = FALSE;
2914  }
2915  return TRUE;
2916  }
2917 
2919  {
2920  /* This handler implements the trick that makes the start button to
2921  get pressed when the user clicked left or below the button */
2922 
2924  WINDOWINFO wi = {sizeof(WINDOWINFO)};
2925 
2926  bHandled = FALSE;
2927 
2928  RECT rcStartBtn;
2929  m_StartButton.GetWindowRect(&rcStartBtn);
2930 
2931  GetWindowInfo(m_hWnd, &wi);
2932 
2933  switch (m_Position)
2934  {
2935  case ABE_TOP:
2936  case ABE_LEFT:
2937  {
2938  if (pt.x > rcStartBtn.right || pt.y > rcStartBtn.bottom)
2939  return 0;
2940  break;
2941  }
2942  case ABE_RIGHT:
2943  {
2944  if (pt.x < rcStartBtn.left || pt.y > rcStartBtn.bottom)
2945  return 0;
2946 
2947  if (rcStartBtn.right + (int)wi.cxWindowBorders * 2 + 1 < wi.rcWindow.right &&
2948  pt.x > rcStartBtn.right)
2949  {
2950  return 0;
2951  }
2952  break;
2953  }
2954  case ABE_BOTTOM:
2955  {
2956  if (pt.x > rcStartBtn.right || pt.y < rcStartBtn.top)
2957  return 0;
2958 
2959  if (rcStartBtn.bottom + (int)wi.cyWindowBorders * 2 + 1 < wi.rcWindow.bottom &&
2960  pt.y > rcStartBtn.bottom)
2961  {
2962  return 0;
2963  }
2964 
2965  break;
2966  }
2967  }
2968 
2969  bHandled = TRUE;
2970  PopupStartMenu();
2971  return 0;
2972  }
2973 
2975  {
2976  /* We want the user to be able to get a context menu even on the nonclient
2977  area (including the sizing border)! */
2978  uMsg = WM_CONTEXTMENU;
2979  wParam = (WPARAM) m_hWnd;
2980 
2981  return OnContextMenu(uMsg, wParam, lParam, bHandled);
2982  }
2983 
2985  {
2986  LRESULT Ret = FALSE;
2987  POINT pt, *ppt = NULL;
2988  HWND hWndExclude = NULL;
2989 
2990  /* Check if the administrator has forbidden access to context menus */
2992  return FALSE;
2993 
2994  pt.x = (SHORT) LOWORD(lParam);
2995  pt.y = (SHORT) HIWORD(lParam);
2996 
2997  if (pt.x != -1 || pt.y != -1)
2998  ppt = &pt;
2999  else
3000  hWndExclude = m_StartButton.m_hWnd;
3001 
3002  if ((HWND) wParam == m_StartButton.m_hWnd)
3003  {
3004  /* Make sure we can't track the context menu if the start
3005  menu is currently being shown */
3007  {
3008  CComPtr<IContextMenu> ctxMenu;
3010  TrackCtxMenu(ctxMenu, ppt, hWndExclude, m_Position == ABE_BOTTOM, this);
3011  }
3012  }
3013  else
3014  {
3015  /* See if the context menu should be handled by the task band site */
3016  if (ppt != NULL && m_TrayBandSite != NULL)
3017  {
3018  HWND hWndAtPt;
3019  POINT ptClient = *ppt;
3020 
3021  /* Convert the coordinates to client-coordinates */
3022  ::MapWindowPoints(NULL, m_hWnd, &ptClient, 1);
3023 
3024  hWndAtPt = ChildWindowFromPoint(ptClient);
3025  if (hWndAtPt != NULL &&
3026  (hWndAtPt == m_Rebar || ::IsChild(m_Rebar, hWndAtPt)))
3027  {
3028  /* Check if the user clicked on the task switch window */
3029  ptClient = *ppt;
3030  ::MapWindowPoints(NULL, m_Rebar, &ptClient, 1);
3031 
3033  if (hWndAtPt == m_TaskSwitch)
3034  goto HandleTrayContextMenu;
3035 
3036  /* Forward the message to the task band site */
3037  m_TrayBandSite->ProcessMessage(m_hWnd, uMsg, wParam, lParam, &Ret);
3038  }
3039  else
3040  goto HandleTrayContextMenu;
3041  }
3042  else
3043  {
3044 HandleTrayContextMenu:
3045  /* Tray the default tray window context menu */
3046  TrackCtxMenu(this, ppt, NULL, FALSE, this);
3047  }
3048  }
3049  return Ret;
3050  }
3051 
3053  {
3054  LRESULT Ret = FALSE;
3055  /* FIXME: We can't check with IsChild whether the hwnd is somewhere inside
3056  the rebar control! But we shouldn't forward messages that the band
3057  site doesn't handle, such as other controls (start button, tray window */
3058 
3059  HRESULT hr = E_FAIL;
3060 
3061  if (m_TrayBandSite)
3062  {
3063  hr = m_TrayBandSite->ProcessMessage(m_hWnd, uMsg, wParam, lParam, &Ret);
3064  if (SUCCEEDED(hr))
3065  return Ret;
3066  }
3067 
3068  if (m_TrayBandSite == NULL || FAILED(hr))
3069  {
3070  const NMHDR *nmh = (const NMHDR *) lParam;
3071 
3072  if (nmh->hwndFrom == m_TrayNotify)
3073  {
3074  switch (nmh->code)
3075  {
3076  case NTNWM_REALIGN:
3077  /* Cause all controls to be aligned */
3079  break;
3080  }
3081  }
3082  }
3083  return Ret;
3084  }
3085 
3087  {
3089  if (m_ShowDesktopButton.PtInButton(pt)) // Did you click the button?
3090  {
3092  bHandled = TRUE;
3093  return TRUE;
3094  }
3095 
3096  return FALSE;
3097  }
3098 
3100  {
3101  /* Let the clock handle the double click */
3103 
3104  /* We "handle" this message so users can't cause a weird maximize/restore
3105  window animation when double-clicking the tray window! */
3106  return TRUE;
3107  }
3108 
3110  {
3112  return FALSE;
3113  }
3114 
3116  {
3117  DestroyWindow();
3118  return TRUE;
3119  }
3120 
3122  {
3123  HWND hwndStartMenu;
3124  HRESULT hr = IUnknown_GetWindow(m_StartMenuPopup, &hwndStartMenu);
3125  if (FAILED_UNEXPECTEDLY(hr))
3126  return FALSE;
3127 
3128  if (::IsWindowVisible(hwndStartMenu))
3129  HideStartMenu();
3130  else
3131  PopupStartMenu();
3132 
3133  return TRUE;
3134  }
3135 
3137  {
3138  /*
3139  * TWM_DOEXITWINDOWS is send by the CDesktopBrowser to us
3140  * to show the shutdown dialog. Also a WM_CLOSE message sent
3141  * by apps should show the dialog.
3142  */
3143  return DoExitWindows();
3144  }
3145 
3147  {
3148  if (wParam == SC_CLOSE)
3149  {
3150  return DoExitWindows();
3151  }
3152 
3153  bHandled = FALSE;
3154  return TRUE;
3155  }
3156 
3158  {
3159  bHandled = TRUE;
3160  return (LRESULT)m_TaskSwitch;
3161  }
3162 
3164  {
3165  return HandleHotKey(wParam);
3166  }
3167 
3169  {
3176  };
3177 
3179  {
3180  WCHAR szClass[32];
3181  GetClassNameW(hwnd, szClass, _countof(szClass));
3182  return wcscmp(szClass, L"#32770") == 0;
3183  }
3184 
3186  {
3188  if (hwnd == info->hwndDesktop || hwnd == info->hTrayWnd ||
3189  hwnd == info->hwndProgman)
3190  {
3191  return TRUE;
3192  }
3193  if (!info->bShowDesktop)
3194  {
3195  if (!::IsWindowEnabled(hwnd) || IsDialog(hwnd))
3196  return TRUE;
3197  HWND hwndOwner = ::GetWindow(hwnd, GW_OWNER);
3198  if (hwndOwner && !::IsWindowEnabled(hwndOwner))
3199  return TRUE;
3200  }
3201  if (::IsWindowVisible(hwnd) && !::IsIconic(hwnd))
3202  {
3204  info->bRet = TRUE;
3205  info->pMinimizedAll->Add(hwnd);
3206  }
3207  return TRUE;
3208  }
3209 
3210  VOID MinimizeAll(BOOL bShowDesktop = FALSE)
3211  {
3213  info.hwndDesktop = GetDesktopWindow();;
3214  info.hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
3215  info.hwndProgman = FindWindowW(L"Progman", NULL);
3216  info.bRet = FALSE;
3217  info.pMinimizedAll = &g_MinimizedAll;
3218  info.bShowDesktop = bShowDesktop;
3220 
3221  // invalid handles should be cleared to avoid mismatch of handles
3222  for (INT i = 0; i < g_MinimizedAll.GetSize(); ++i)
3223  {
3224  if (!::IsWindow(g_MinimizedAll[i]))
3225  g_MinimizedAll[i] = NULL;
3226  }
3227 
3230  }
3231 
3233  {
3234  MinimizeAll(TRUE);
3235  }
3236 
3238  {
3239  for (INT i = g_MinimizedAll.GetSize() - 1; i >= 0; --i)
3240  {
3242  if (::IsWindowVisible(hwnd) && ::IsIconic(hwnd))
3243  {
3245  }
3246  }
3247  g_MinimizedAll.RemoveAll();
3248  }
3249 
3251  {
3252  LRESULT Ret = FALSE;
3253 
3254  if ((HWND) lParam == m_StartButton.m_hWnd)
3255  {
3256  return FALSE;
3257  }
3258 
3259  if (m_TrayBandSite == NULL || FAILED_UNEXPECTEDLY(m_TrayBandSite->ProcessMessage(m_hWnd, uMsg, wParam, lParam, &Ret)))
3260  {
3261  return HandleCommand(LOWORD(wParam));
3262  }
3263  return Ret;
3264  }
3265 
3267  {
3268  POINT pt;
3269  ::GetCursorPos(&pt);
3272 
3274  {
3276  }
3277 
3278  return TRUE;
3279  }
3280 
3282  {
3283  if (wParam == TIMER_ID_MOUSETRACK)
3284  {
3286  }
3287  else if (wParam == TIMER_ID_AUTOHIDE)
3288  {
3289  ProcessAutoHide();
3290  }
3291 
3292  bHandled = FALSE;
3293  return TRUE;
3294  }
3295 
3297  {
3299  DrawShowDesktopButton(); // We have to draw non-client area
3300  bHandled = TRUE;
3301  return ret;
3302  }
3303 
3305  {
3306  RECT *rc = NULL;
3307  /* Ignore WM_NCCALCSIZE if we are not themed or locked */
3309  {
3310  bHandled = FALSE;
3311  return 0;
3312  }
3313  if(!wParam)
3314  {
3315  rc = (RECT*)wParam;
3316  }
3317  else
3318  {
3320  if(prms->lppos->flags & SWP_NOSENDCHANGING)
3321  {
3322  bHandled = FALSE;
3323  return 0;
3324  }
3325  rc = &prms->rgrc[0];
3326  }
3327 
3329 
3330  return 0;
3331  }
3332 
3334  {
3335  HMENU hMenu = (HMENU)wParam;
3337  {
3341  if (g_Arrangement != NONE)
3342  {
3345  MENUITEMINFOW mii = { sizeof(mii) };
3347  mii.fMask = MIIM_TYPE;
3348  mii.fType = MFT_STRING;
3349  mii.dwTypeData = const_cast<LPWSTR>(&strCaption[0]);
3351  }
3352  else
3353  {
3355  }
3356  }
3357  else
3358  {
3363  g_Arrangement = NONE;
3364  g_WindowPosBackup.RemoveAll();
3365  }
3366  return 0;
3367  }
3368 
3370  {
3371 #if 0
3372  LPNMRBAUTOSIZE as = (LPNMRBAUTOSIZE) nmhdr;
3373 
3374  if (!as->fChanged)
3375  return 0;
3376 
3377  RECT rc;
3378  ::GetWindowRect(m_hWnd, &rc);
3379 
3380  SIZE szWindow = {
3381  rc.right - rc.left,
3382  rc.bottom - rc.top };
3383  SIZE szTarget = {
3384  as->rcTarget.right - as->rcTarget.left,
3385  as->rcTarget.bottom - as->rcTarget.top };
3386  SIZE szActual = {
3387  as->rcActual.right - as->rcActual.left,
3388  as->rcActual.bottom - as->rcActual.top };
3389 
3390  SIZE borders = {
3391  szWindow.cx - szTarget.cx,
3392  szWindow.cy - szTarget.cx,
3393  };
3394 
3395  switch (m_Position)
3396  {
3397  case ABE_LEFT:
3398  szWindow.cx = szActual.cx + borders.cx;
3399  break;
3400  case ABE_TOP:
3401  szWindow.cy = szActual.cy + borders.cy;
3402  break;
3403  case ABE_RIGHT:
3404  szWindow.cx = szActual.cx + borders.cx;
3405  rc.left = rc.right - szWindow.cy;
3406  break;
3407  case ABE_BOTTOM:
3408  szWindow.cy = szActual.cy + borders.cy;
3409  rc.top = rc.bottom - szWindow.cy;
3410  break;
3411  }
3412 
3413  SetWindowPos(NULL, rc.left, rc.top, szWindow.cx, szWindow.cy, SWP_NOACTIVATE | SWP_NOZORDER);
3414 #else
3415  bHandled = FALSE;
3416 #endif
3417  return 0;
3418  }
3419 
3421  {
3422  TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
3423 
3424  /* Propagate the new settings to the children */
3427 
3428  /* Toggle autohide */
3429  if (newSettings->sr.AutoHide != g_TaskbarSettings.sr.AutoHide)
3430  {
3431  g_TaskbarSettings.sr.AutoHide = newSettings->sr.AutoHide;
3434  if (!newSettings->sr.AutoHide)
3435  SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER);
3436  else
3438  }
3439 
3440  /* Toggle lock state */
3441  Lock(newSettings->bLock);
3442 
3443  /* Toggle OnTop state */
3444  if (newSettings->sr.AlwaysOnTop != g_TaskbarSettings.sr.AlwaysOnTop)
3445  {
3447  HWND hWndInsertAfter = newSettings->sr.AlwaysOnTop ? HWND_TOPMOST : HWND_BOTTOM;
3448  SetWindowPos(hWndInsertAfter, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
3449  }
3450 
3452  return 0;
3453  }
3454 
3456 
3459  {
3460  MSG Msg;
3461  LRESULT lRet;
3462 
3463  Msg.hwnd = m_hWnd;
3464  Msg.message = uMsg;
3465  Msg.wParam = wParam;
3466  Msg.lParam = lParam;
3467 
3468  if (m_StartMenuBand->TranslateMenuMessage(&Msg, &lRet) == S_OK)
3469  {
3470  return lRet;
3471  }
3472 
3473  wParam = Msg.wParam;
3474  lParam = Msg.lParam;
3475  }
3476  MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged)
3482  /*MESSAGE_HANDLER(WM_DESTROY, OnDestroy)*/
3489  MESSAGE_HANDLER(WM_DISPLAYCHANGE, OnDisplayChange)
3515  ALT_MSG_MAP(1)
3516  END_MSG_MAP()
3517 
3518  /*****************************************************************************/
3519 
3521  {
3522  MSG Msg;
3523 
3524  /* FIXME: We should keep a reference here... */
3525 
3526  while (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
3527  {
3528  if (Msg.message == WM_QUIT)
3529  break;
3530 
3531  if (m_StartMenuBand == NULL ||
3532  m_StartMenuBand->IsMenuMessage(&Msg) != S_OK)
3533  {
3535  DispatchMessage(&Msg);
3536  }
3537  }
3538  }
3539 
3541  {
3542  MSG Msg;
3543  BOOL Ret;
3544 
3545  /* FIXME: We should keep a reference here... */
3546 
3547  while (true)
3548  {
3549  Ret = GetMessage(&Msg, NULL, 0, 0);
3550 
3551  if (!Ret || Ret == -1)
3552  break;
3553 
3554  if (m_StartMenuBand == NULL ||
3555  m_StartMenuBand->IsMenuMessage(&Msg) != S_OK)
3556  {
3558  DispatchMessage(&Msg);
3559  }
3560  }
3561  }
3562 
3563  /*
3564  * IShellDesktopTray
3565  *
3566  * NOTE: this is a very windows-specific COM interface used by SHCreateDesktop()!
3567  * These are the calls I observed, it may be wrong/incomplete/buggy!!!
3568  * The reason we implement it is because we have to use SHCreateDesktop() so
3569  * that the shell provides the desktop window and all the features that come
3570  * with it (especially positioning of desktop icons)
3571  */
3572 
3574  {
3575  /* FIXME: Return ABS_ flags? */
3576  TRACE("IShellDesktopTray::GetState() unimplemented!\n");
3577  return 0;
3578  }
3579 
3581  {
3582  TRACE("IShellDesktopTray::GetTrayWindow(0x%p)\n", phWndTray);
3583  *phWndTray = m_hWnd;
3584  return S_OK;
3585  }
3586 
3588  {
3589  TRACE("IShellDesktopTray::RegisterDesktopWindow(0x%p)\n", hWndDesktop);
3590 
3591  m_DesktopWnd = hWndDesktop;
3592  return S_OK;
3593  }
3594 
3595  virtual HRESULT STDMETHODCALLTYPE Unknown(IN DWORD dwUnknown1, IN DWORD dwUnknown2)
3596  {
3597  TRACE("IShellDesktopTray::Unknown(%u,%u) unimplemented!\n", dwUnknown1, dwUnknown2);
3598  return S_OK;
3599  }
3600 
3602  {
3603  m_StartButton.SendMessageW(BM_SETSTATE, FALSE, 0);
3604  return S_OK;
3605  }
3606 
3608  {
3609  if (!phwnd)
3610  return E_INVALIDARG;
3611  *phwnd = m_hWnd;
3612  return S_OK;
3613  }
3614 
3616  {
3617  return E_NOTIMPL;
3618  }
3619 
3620  void _Init()
3621  {
3622  m_Position = (DWORD) -1;
3623  }
3624 
3626 
3629  /*COM_INTERFACE_ENTRY_IID(IID_ITrayWindow, ITrayWindow)*/
3632  COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
3633  END_COM_MAP()
3634 };
3635 
3639  public IContextMenu
3640 {
3645 
3646 public:
3647  HRESULT Initialize(ITrayWindow * pTrayWnd, IN HWND hWndOwner)
3648  {
3649  this->TrayWnd = (CTrayWindow *) pTrayWnd;
3650  this->hWndOwner = hWndOwner;
3651  this->m_idCmdCmFirst = 0;
3652  return S_OK;
3653  }
3654 
3655  virtual HRESULT STDMETHODCALLTYPE
3657  UINT indexMenu,
3658  UINT idCmdFirst,
3659  UINT idCmdLast,
3660  UINT uFlags)
3661  {
3662  HMENU hMenuBase;
3663 
3665 
3666  if (g_MinimizedAll.GetSize() != 0 && !::IsThereAnyEffectiveWindow(TRUE))
3667  {
3668  CStringW strRestoreAll(MAKEINTRESOURCEW(IDS_RESTORE_ALL));
3669  MENUITEMINFOW mii = { sizeof(mii) };
3670  mii.fMask = MIIM_ID | MIIM_TYPE;
3672  mii.fType = MFT_STRING;
3673  mii.dwTypeData = const_cast<LPWSTR>(&strRestoreAll[0]);
3675  }
3676 
3677  if (!hMenuBase)
3678  return HRESULT_FROM_WIN32(GetLastError());
3679 
3680  if (SHRestricted(REST_CLASSICSHELL) != 0)
3681  {
3682  DeleteMenu(hPopup,
3684  MF_BYCOMMAND);
3685  }
3686 
3687  CheckMenuItem(hMenuBase,
3690 
3691  UINT idCmdNext;
3692  idCmdNext = Shell_MergeMenus(hPopup, hMenuBase, indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS | MM_ADDSEPARATOR);
3693  m_idCmdCmFirst = idCmdNext - idCmdFirst;
3694 
3695  ::DestroyMenu(hMenuBase);
3696 
3697  if (TrayWnd->m_TrayBandSite != NULL)
3698  {
3699  pcm.Release();
3700  if (FAILED(TrayWnd->m_TrayBandSite->AddContextMenus(
3701  hPopup,
3702  indexMenu,
3703  idCmdNext,
3704  idCmdLast,
3705  CMF_NORMAL,
3706  &pcm)))
3707  {
3708  WARN("AddContextMenus failed.\n");
3709  pcm.Release();
3710  }
3711  }
3712 
3713  return S_OK;
3714  }
3715 
3716  virtual HRESULT STDMETHODCALLTYPE
3718  {
3719  UINT uiCmdId = PtrToUlong(lpici->lpVerb);
3720  if (uiCmdId != 0)
3721  {
3722  if (uiCmdId >= m_idCmdCmFirst)
3723  {
3724  CMINVOKECOMMANDINFO cmici = { 0 };
3725 
3726  if (pcm != NULL)
3727  {
3728  /* Setup and invoke the shell command */
3729  cmici.cbSize = sizeof(cmici);
3730  cmici.hwnd = hWndOwner;
3731  cmici.lpVerb = (LPCSTR) MAKEINTRESOURCEW(uiCmdId - m_idCmdCmFirst);
3732  cmici.nShow = SW_NORMAL;
3733 
3734  pcm->InvokeCommand(&cmici);
3735  }
3736  }
3737  else
3738  {
3739  TrayWnd->ExecContextMenuCmd(uiCmdId);
3740  }
3741  }
3742 
3743  return S_OK;
3744  }
3745 
3746  virtual HRESULT STDMETHODCALLTYPE
3748  UINT uType,
3749  UINT *pwReserved,
3750  LPSTR pszName,
3751  UINT cchMax)
3752  {
3753  return E_NOTIMPL;
3754  }
3755 
3757  {
3758  }
3759 
3761  {
3762  }
3763 
3765  COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
3766  END_COM_MAP()
3767 };
3768 
3769 HRESULT TrayWindowCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu)
3770 {
3772  mnu->Initialize(TrayWnd, hWndOwner);
3773  *ppCtxMenu = mnu;
3774  return S_OK;
3775 }
3776 
3777 HRESULT CreateTrayWindow(ITrayWindow ** ppTray)
3778 {
3780  if (Tray == NULL)
3781  return E_OUTOFMEMORY;
3782 
3783  Tray->_Init();
3784  Tray->Open();
3785 
3786  *ppTray = (ITrayWindow *) Tray;
3787 
3788  return S_OK;
3789 }
3790 
3791 HRESULT
3792 Tray_OnStartMenuDismissed(ITrayWindow* Tray)
3793 {
3794  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3795  return TrayWindow->RaiseStartButton();
3796 }
3797 
3798 VOID TrayProcessMessages(ITrayWindow *Tray)
3799 {
3800  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3801  TrayWindow->TrayProcessMessages();
3802 }
3803 
3804 VOID TrayMessageLoop(ITrayWindow *Tray)
3805 {
3806  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3807  TrayWindow->TrayMessageLoop();
3808 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define SHOW_DESKTOP_TIMER_ID
Definition: traywnd.cpp:410
SIZE GetSize()
Definition: traywnd.cpp:205
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1682
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
CComPtr< IContextMenu > pcm
Definition: traywnd.cpp:3643
#define IDHK_NEXT_TASK
Definition: traywnd.cpp:53
#define IDHK_PREV_TASK
Definition: traywnd.cpp:54
DWORD NewPosSize
Definition: traywnd.cpp:561
#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:3157
HMONITOR GetMonitorFromRect(IN const RECT *pRect)
Definition: traywnd.cpp:1256
#define WS_DISABLED
Definition: pedump.c:621
#define HTTOP
Definition: winuser.h:2480
VOID HideStartMenu()
Definition: traywnd.cpp:910
#define BS_LEFT
Definition: winuser.h:265
BOOL IsShowDesktopButtonNeeded()
Definition: traywnd.cpp:2503
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:2657
#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:542
#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:753
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:183
#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:739
LRESULT HandleHotKey(DWORD id)
Definition: traywnd.cpp:915
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:399
#define MF_BYCOMMAND
Definition: winuser.h:202
LRESULT OnEnterSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2830
#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:2483
#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:2646
#define ID_SHELL_CMD_PROPERTIES
Definition: resource.h:187
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:2599
#define RGB(r, g, b)
Definition: precomp.h:62
void FitToRebar(PRECT pRect)
Definition: traywnd.cpp:2029
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:1373
DWORD WINAPI TrayPropertiesThread()
Definition: traywnd.cpp:724
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:2491
#define AUTOHIDE_SPEED_SHOW
Definition: traywnd.cpp:38
UINT cxWindowBorders
Definition: winuser.h:3762
#define ID_SHELL_CMD_RESTORE_ALL
Definition: resource.h:199
#define ID_SHELL_CMD_UNDO_ACTION
Definition: resource.h:192
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:2761
#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:3052
#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:961
static COORD Position
Definition: mouse.c:34
#define ID_SHELL_CMD_OPEN_TASKMGR
Definition: resource.h:191
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:2918
#define SIZE_RESTORED
Definition: winuser.h:2495
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
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:448
#define TNWM_GETMINIMUMSIZE
Definition: precomp.h:333
#define SHOW_DESKTOP_MINIMUM_WIDTH
static HDC
Definition: imagelist.c:92
void ProcessAutoHide()
Definition: traywnd.cpp:2162
#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:520
BOOL IsWindow() const
Definition: atlwin.h:941
#define ID_SHELL_CMD_SHOW_DESKTOP
Definition: resource.h:193
ush Pos
Definition: deflate.h:92
LRESULT OnNcLButtonDblClick(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3099
HWND hWnd
Definition: settings.c:17
DWORD IsDragging
Definition: traywnd.cpp:560
#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:299
static HRGN hRgn
Definition: mapping.c:33
HFONT m_Font
Definition: traywnd.cpp:523
CTrayShowDesktopButton m_ShowDesktopButton
Definition: traywnd.cpp:514
#define WM_EXITSIZEMOVE
Definition: winuser.h:1814
int DrawSizerWithTheme(IN HRGN hRgn)
Definition: traywnd.cpp:2299
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:3580
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:3163
#define ZeroMemory
Definition: winbase.h:1670
#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:2842
VOID RestoreAll()
Definition: traywnd.cpp:3237
#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:1456
#define IDS_HELP_COMMAND
Definition: resource.h:102
#define ID_SHELL_CMD_CUST_NOTIF
Definition: resource.h:197
#define WM_NCHITTEST
Definition: winuser.h:1676
HMONITOR GetScreenRectFromRect(IN OUT RECT *pRect, IN DWORD dwFlags)
Definition: traywnd.cpp:1229
#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:551
#define SWP_NOZORDER
Definition: winuser.h:1237
UINT uFlags
Definition: api.c:59
DWORD Flags
Definition: traywnd.cpp:555
void _Init()
Definition: traywnd.cpp:3620
DWORD m_Position
Definition: traywnd.cpp:532
static BOOL CALLBACK FindEffectiveProc(HWND hwnd, LPARAM lParam)
Definition: traywnd.cpp:112
VOID BackupWindowPos()
Definition: traywnd.cpp:85
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:1399
#define SetWindowStyle(hwnd, val)
Definition: utility.h:153
LONG right
Definition: windef.h:308
#define IDC_STARTBTN
Definition: resource.h:135
BOOL WINAPI IsIconic(_In_ HWND)
#define ABE_LEFT
Definition: shellapi.h:17
VOID CheckTrayWndPosition()
Definition: traywnd.cpp:1757
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:2633
#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:152
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetWindowPlacement(_In_ HWND hWnd, _In_ const WINDOWPLACEMENT *)
#define DWORD
Definition: nt_native.h:44
#define ID_SHELL_CMD_CASCADE_WND
Definition: resource.h:196
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:3136
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:760
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:2703
#define TRAYCMD_SHOW_DESKTOP
Definition: undocshell.h:699
VOID OpenTaskManager(IN HWND hWndOwner)
Definition: traywnd.cpp:797
LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:3146
#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:534
#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:2798
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
virtual ~CTrayWindow()
Definition: traywnd.cpp:592
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:525
DWORD Position
Definition: precomp.h:198
DWORD InSizeMove
Definition: traywnd.cpp:559
UINT code
Definition: winuser.h:3149
#define WM_NCPAINT
Definition: winuser.h:1677
HWND m_Rebar
Definition: traywnd.cpp:526
BOOL STDMETHODCALLTYPE IsSpecialHWND(IN HWND hWnd)
Definition: traywnd.cpp:2402
VOID OnDraw(HDC hdc, LPRECT prc)
Definition: traywnd.cpp:470
LRESULT appbar_message(COPYDATASTRUCT *cds)
Definition: appbar.cpp:229
LRESULT EraseBackgroundWithTheme(HDC hdc)
Definition: traywnd.cpp:2283
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
#define SM_CXSCREEN
Definition: winuser.h:953
HWND m_TrayNotify
Definition: traywnd.cpp:528
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:372
#define L(x)
Definition: ntvdm.h:50
LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:2687
#define COLOR_3DFACE
Definition: winuser.h:923
LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: traywnd.cpp:293
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define IDS_TRAYWND_UNDO_CASCADE
Definition: resource.h:105
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:1348
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HWND hwndProgman
Definition: traywnd.cpp:106
#define FALSE
Definition: types.h:117
HRESULT Tray_OnStartMenuDismissed(ITrayWindow *Tray)
Definition: traywnd.cpp:3792
#define WM_NCACTIVATE
Definition: winuser.h:1678
HWND Create(HWND hwndParent)
Definition: traywnd.cpp:262
GLenum const GLfloat * params
Definition: glext.h:5645
#define TWM_SETTINGSCHANGED
Definition: precomp.h:132
CSimpleArray< HWND > * pMinimizedAll
Definition: traywnd.cpp:3174
virtual HRESULT STDMETHODCALLTYPE InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
Definition: traywnd.cpp:3717
#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:3109
TRACKMOUSEEVENT m_MouseTrackingInfo
Definition: traywnd.cpp:546
#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:196
#define CWP_SKIPINVISIBLE
Definition: winuser.h:208
void ProcessMouseTracking()
Definition: traywnd.cpp:2112
#define SM_CYDLGFRAME
Definition: winuser.h:962
BOOL STDMETHODCALLTYPE Lock(IN BOOL bLock)
Definition: traywnd.cpp:2413
#define TPM_TOPALIGN
Definition: winuser.h:2373
#define ShellExecute
Definition: shellapi.h:691
void UpdateFonts()
Definition: traywnd.cpp:1198
#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:3185
#define CWP_SKIPDISABLED
Definition: winuser.h:209
VOID RestoreWindowPos()
Definition: traywnd.cpp:90
#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:2347
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
CSimpleArray< HWND > g_MinimizedAll
Definition: traywnd.cpp:172
#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:3798
#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:519
VOID OpenCommonStartMenuDirectory(IN HWND hWndOwner, IN LPCTSTR lpOperation)
Definition: traywnd.cpp:779
#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