ReactOS 0.4.16-dev-1163-gec5b142
taskswnd.cpp
Go to the documentation of this file.
1/*
2 * ReactOS Explorer
3 *
4 * Copyright 2006 - 2007 Thomas Weidenmueller <w3seek@reactos.org>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "precomp.h"
22#include <commoncontrols.h>
23#include <regstr.h>
24#include <shlwapi_undoc.h>
25
26/* Set DUMP_TASKS to 1 to enable a dump of the tasks and task groups every
27 5 seconds */
28#define DUMP_TASKS 0
29#define DEBUG_SHELL_HOOK 0
30
31#define MAX_TASKS_COUNT (0x7FFF)
32#define TASK_ITEM_ARRAY_ALLOC 64
33
34const WCHAR szTaskSwitchWndClass[] = L"MSTaskSwWClass";
35const WCHAR szRunningApps[] = L"Running Applications";
36
37#if DEBUG_SHELL_HOOK
38const struct {
39 INT msg;
40 LPCWSTR msg_name;
41} hshell_msg [] = {
42 { HSHELL_WINDOWCREATED, L"HSHELL_WINDOWCREATED" },
43 { HSHELL_WINDOWDESTROYED, L"HSHELL_WINDOWDESTROYED" },
44 { HSHELL_ACTIVATESHELLWINDOW, L"HSHELL_ACTIVATESHELLWINDOW" },
45 { HSHELL_WINDOWACTIVATED, L"HSHELL_WINDOWACTIVATED" },
46 { HSHELL_GETMINRECT, L"HSHELL_GETMINRECT" },
47 { HSHELL_REDRAW, L"HSHELL_REDRAW" },
48 { HSHELL_TASKMAN, L"HSHELL_TASKMAN" },
49 { HSHELL_LANGUAGE, L"HSHELL_LANGUAGE" },
50 { HSHELL_SYSMENU, L"HSHELL_SYSMENU" },
51 { HSHELL_ENDTASK, L"HSHELL_ENDTASK" },
52 { HSHELL_ACCESSIBILITYSTATE, L"HSHELL_ACCESSIBILITYSTATE" },
53 { HSHELL_APPCOMMAND, L"HSHELL_APPCOMMAND" },
54 { HSHELL_WINDOWREPLACED, L"HSHELL_WINDOWREPLACED" },
55 { HSHELL_WINDOWREPLACING, L"HSHELL_WINDOWREPLACING" },
56 { HSHELL_RUDEAPPACTIVATED, L"HSHELL_RUDEAPPACTIVATED" },
57};
58#endif
59
60typedef struct _TASK_GROUP
61{
62 /* We have to use a linked list instead of an array so we don't have to
63 update all pointers to groups in the task item array when removing
64 groups. */
66
70 union
71 {
73 struct
74 {
75
77 };
78 };
80
81typedef struct _TASK_ITEM
82{
87
88 union
89 {
91 struct
92 {
93
94 /* IsFlashing is TRUE when the task bar item should be flashing. */
96
97 /* RenderFlashed is only TRUE if the task bar item should be
98 drawn with a flash. */
100 };
101 };
103
104
106{
114public:
115
117 m_ThreadId(0),
120 m_Status(NULL),
122 {
123 }
124
126 {
128 {
129 /* Try to unstuck Show */
132 if (ret == WAIT_TIMEOUT)
135 }
136 }
137
139 {
140 HRESULT hr;
141 CComPtr<IUserNotification> pnotification;
142
145 return hr;
146
147 hr = CoCreateInstance(CLSID_UserNotification,
148 NULL,
149 CLSCTX_INPROC_SERVER,
150 IID_PPV_ARG(IUserNotification, &pnotification));
152 return hr;
153
154 hr = pnotification->SetBalloonInfo(m_Title, m_Text, NIIF_WARNING);
156 return hr;
157
158 hr = pnotification->SetIconInfo(NULL, NULL);
160 return hr;
161
162 /* Show will block until the balloon closes */
163 hr = pnotification->Show(NULL, 0);
165 return hr;
166
167 return S_OK;
168 }
169
171 {
172 CHardErrorThread* pThis = reinterpret_cast<CHardErrorThread*>(lpParameter);
173 pThis->ThreadProc();
174 CloseHandle(pThis->m_hThread);
177 return 0;
178 }
179
181 {
183
184 /* Ignore the new message if we are already showing one */
185 if (bIsRunning)
186 return;
187
188 m_Status = pData->Status;
189 m_dwType = pData->dwType;
190 m_Title = (PWCHAR)((ULONG_PTR)pData + pData->TitleOffset);
191 m_Text = (PWCHAR)((ULONG_PTR)pData + pData->MessageOffset);
193 if (!m_hThread)
194 {
197 }
198 }
199};
200
202 public CWindowImplBaseT< CToolbar<TASK_ITEM>, CControlWinTraits >
203{
204public:
205 INT UpdateTbButtonSpacing(IN BOOL bHorizontal, IN BOOL bThemed, IN UINT uiRows = 0, IN UINT uiBtnsPerLine = 0)
206 {
207 TBMETRICS tbm;
208
209 tbm.cbSize = sizeof(tbm);
211
212 tbm.cxBarPad = tbm.cyBarPad = 0;
213
214 if (bThemed)
215 {
216 tbm.cxButtonSpacing = 0;
217 tbm.cyButtonSpacing = 0;
218 }
219 else
220 {
221 if (bHorizontal || uiBtnsPerLine > 1)
223 else
224 tbm.cxButtonSpacing = 0;
225
226 if (!bHorizontal || uiRows > 1)
228 else
229 tbm.cyButtonSpacing = 0;
230 }
231
232 SetMetrics(&tbm);
233
234 return tbm.cxButtonSpacing;
235 }
236
238 {
240 }
241
243 {
246 }
247
248 BOOL SetButtonCommandId(IN INT iButtonIndex, IN INT iCommandId)
249 {
250 TBBUTTONINFO tbbi;
251
252 tbbi.cbSize = sizeof(tbbi);
253 tbbi.dwMask = TBIF_BYINDEX | TBIF_COMMAND;
254 tbbi.idCommand = iCommandId;
255
256 return SetButtonInfo(iButtonIndex, &tbbi) != 0;
257 }
258
260 {
261 POINT pt;
262
263 /* See if the mouse is on a button */
267
268 INT index = HitTest(&pt);
269 if (index < 0)
270 {
271 /* Make the control appear to be transparent outside of any buttons */
272 return HTTRANSPARENT;
273 }
274
275 bHandled = FALSE;
276 return 0;
277 }
278
279public:
283
285 {
289
290 // HACK & FIXME: CORE-18016
291 HWND toolbar = CToolbar::Create(hWndParent, styles);
292 m_hWnd = NULL;
293 return SubclassWindow(toolbar);
294 }
295};
296
298 public CComCoClass<CTaskSwitchWnd>,
299 public CComObjectRootEx<CComMultiThreadModelNoCS>,
300 public CWindowImpl < CTaskSwitchWnd, CWindow, CControlWinTraits >,
301 public IOleWindow
302{
304
306
308
311
315
319
321
324
326
329
330public:
338 m_Theme(NULL),
340 m_ButtonCount(0),
344 {
347 }
348 virtual ~CTaskSwitchWnd() { }
349
351 {
352 /* Get the window text without sending a message so we don't hang if an
353 application isn't responding! */
354 return InternalGetWindowText(TaskItem->hWnd, szBuf, cchBuf);
355 }
356
357
358#if DUMP_TASKS != 0
359 VOID DumpTasks()
360 {
361 PTASK_GROUP CurrentGroup;
362 PTASK_ITEM CurrentTaskItem, LastTaskItem;
363
364 TRACE("Tasks dump:\n");
366 {
367 CurrentGroup = m_TaskGroups;
368 while (CurrentGroup != NULL)
369 {
370 TRACE("- Group PID: 0x%p Tasks: %d Index: %d\n", CurrentGroup->dwProcessId, CurrentGroup->dwTaskCount, CurrentGroup->Index);
371
372 CurrentTaskItem = m_TaskItems;
373 LastTaskItem = CurrentTaskItem + m_TaskItemCount;
374 while (CurrentTaskItem != LastTaskItem)
375 {
376 if (CurrentTaskItem->Group == CurrentGroup)
377 {
378 TRACE(" + Task hwnd: 0x%p Index: %d\n", CurrentTaskItem->hWnd, CurrentTaskItem->Index);
379 }
380 CurrentTaskItem++;
381 }
382
383 CurrentGroup = CurrentGroup->Next;
384 }
385
386 CurrentTaskItem = m_TaskItems;
387 LastTaskItem = CurrentTaskItem + m_TaskItemCount;
388 while (CurrentTaskItem != LastTaskItem)
389 {
390 if (CurrentTaskItem->Group == NULL)
391 {
392 TRACE("- Task hwnd: 0x%p Index: %d\n", CurrentTaskItem->hWnd, CurrentTaskItem->Index);
393 }
394 CurrentTaskItem++;
395 }
396 }
397 else
398 {
399 CurrentTaskItem = m_TaskItems;
400 LastTaskItem = CurrentTaskItem + m_TaskItemCount;
401 while (CurrentTaskItem != LastTaskItem)
402 {
403 TRACE("- Task hwnd: 0x%p Index: %d\n", CurrentTaskItem->hWnd, CurrentTaskItem->Index);
404 CurrentTaskItem++;
405 }
406 }
407 }
408#endif
409
410 VOID UpdateIndexesAfter(IN INT iIndex, BOOL bInserted)
411 {
412 PTASK_GROUP CurrentGroup;
413 PTASK_ITEM CurrentTaskItem, LastTaskItem;
414 INT NewIndex;
415
416 int offset = bInserted ? +1 : -1;
417
419 {
420 /* Update all affected groups */
421 CurrentGroup = m_TaskGroups;
422 while (CurrentGroup != NULL)
423 {
424 if (CurrentGroup->IsCollapsed &&
425 CurrentGroup->Index >= iIndex)
426 {
427 /* Update the toolbar buttons */
428 NewIndex = CurrentGroup->Index + offset;
429 if (m_TaskBar.SetButtonCommandId(CurrentGroup->Index + offset, NewIndex))
430 {
431 CurrentGroup->Index = NewIndex;
432 }
433 else
434 CurrentGroup->Index = -1;
435 }
436
437 CurrentGroup = CurrentGroup->Next;
438 }
439 }
440
441 /* Update all affected task items */
442 CurrentTaskItem = m_TaskItems;
443 LastTaskItem = CurrentTaskItem + m_TaskItemCount;
444 while (CurrentTaskItem != LastTaskItem)
445 {
446 CurrentGroup = CurrentTaskItem->Group;
447 if (CurrentGroup != NULL)
448 {
449 if (!CurrentGroup->IsCollapsed &&
450 CurrentTaskItem->Index >= iIndex)
451 {
452 goto UpdateTaskItemBtn;
453 }
454 }
455 else if (CurrentTaskItem->Index >= iIndex)
456 {
457 UpdateTaskItemBtn:
458 /* Update the toolbar buttons */
459 NewIndex = CurrentTaskItem->Index + offset;
460 if (m_TaskBar.SetButtonCommandId(CurrentTaskItem->Index + offset, NewIndex))
461 {
462 CurrentTaskItem->Index = NewIndex;
463 }
464 else
465 CurrentTaskItem->Index = -1;
466 }
467
468 CurrentTaskItem++;
469 }
470 }
471
472
474 {
475 ASSERT(TaskGroup->Index >= 0);
476
477 /* FIXME: Implement */
478
479 return TaskGroup->Index;
480 }
481
483 {
484 ASSERT(TaskGroup->dwTaskCount > 0);
485 ASSERT(TaskGroup->IsCollapsed);
486 ASSERT(TaskGroup->Index >= 0);
487
488 /* FIXME: Implement */
489 }
490
492 {
493 HICON hIcon = NULL;
494
495 /* Retrieve icon by sending a message */
496#define GET_ICON(type) \
497 SendMessageTimeout(hwnd, WM_GETICON, (type), 0, SMTO_NOTIMEOUTIFNOTHUNG, 100, (PDWORD_PTR)&hIcon)
498
499 LRESULT bAlive = GET_ICON(g_TaskbarSettings.bSmallIcons ? ICON_SMALL2 : ICON_BIG);
500 if (hIcon)
501 return hIcon;
502
503 if (bAlive)
504 {
505 bAlive = GET_ICON(ICON_SMALL);
506 if (hIcon)
507 return hIcon;
508 }
509
510 if (bAlive)
511 {
513 if (hIcon)
514 return hIcon;
515 }
516#undef GET_ICON
517
518 /* If we failed, retrieve icon from the window class */
520 if (hIcon)
521 return hIcon;
522
524 }
525
527 {
528 TBBUTTONINFO tbbi = { 0 };
529 HICON icon;
530 WCHAR windowText[255];
531
532 ASSERT(TaskItem->Index >= 0);
533
534 tbbi.cbSize = sizeof(tbbi);
535 tbbi.dwMask = TBIF_BYINDEX | TBIF_STATE | TBIF_TEXT | TBIF_IMAGE;
536 tbbi.fsState = TBSTATE_ENABLED;
537 if (m_ActiveTaskItem == TaskItem)
538 tbbi.fsState |= TBSTATE_CHECKED;
539
540 if (TaskItem->RenderFlashed)
541 tbbi.fsState |= TBSTATE_MARKED;
542
543 /* Check if we're updating a button that is the last one in the
544 line. If so, we need to set the TBSTATE_WRAP flag! */
545 if (!m_Tray->IsHorizontal() || (m_ButtonsPerLine != 0 &&
546 (TaskItem->Index + 1) % m_ButtonsPerLine == 0))
547 {
548 tbbi.fsState |= TBSTATE_WRAP;
549 }
550
552 {
553 tbbi.pszText = windowText;
554 }
555
556 icon = GetWndIcon(TaskItem->hWnd);
557 if (!icon)
558 icon = static_cast<HICON>(LoadImageW(NULL, MAKEINTRESOURCEW(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
559 TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, TaskItem->IconIndex, icon);
560 tbbi.iImage = TaskItem->IconIndex;
561
562 if (!m_TaskBar.SetButtonInfo(TaskItem->Index, &tbbi))
563 {
564 TaskItem->Index = -1;
565 return -1;
566 }
567
568 TRACE("Updated button %d for hwnd 0x%p\n", TaskItem->Index, TaskItem->hWnd);
569 return TaskItem->Index;
570 }
571
573 {
574 TBBUTTONINFO tbbi;
575 PTASK_ITEM currentTaskItem, LastItem;
576
577 if (TaskItem->IconIndex == -1)
578 return;
579
580 tbbi.cbSize = sizeof(tbbi);
581 tbbi.dwMask = TBIF_IMAGE;
582
583 currentTaskItem = m_TaskItems;
584 LastItem = currentTaskItem + m_TaskItemCount;
585 while (currentTaskItem != LastItem)
586 {
587 if (currentTaskItem->IconIndex > TaskItem->IconIndex)
588 {
589 currentTaskItem->IconIndex--;
590 tbbi.iImage = currentTaskItem->IconIndex;
591
592 m_TaskBar.SetButtonInfo(currentTaskItem->Index, &tbbi);
593 }
594 currentTaskItem++;
595 }
596
597 ImageList_Remove(m_ImageList, TaskItem->IconIndex);
598 }
599
601 IN PTASK_GROUP TaskGroup OPTIONAL,
602 IN PTASK_ITEM NewTaskItem OPTIONAL)
603 {
604 PTASK_ITEM TaskItem, LastTaskItem, FoundTaskItem = NULL;
605 DWORD dwTaskCount;
606
608
609 TaskItem = m_TaskItems;
610 LastTaskItem = TaskItem + m_TaskItemCount;
611
612 dwTaskCount = (TaskGroup != NULL ? TaskGroup->dwTaskCount : MAX_TASKS_COUNT);
613
614 ASSERT(dwTaskCount > 0);
615
616 while (TaskItem != LastTaskItem)
617 {
618 if (TaskItem->Group == TaskGroup)
619 {
620 if ((NewTaskItem != NULL && TaskItem != NewTaskItem) || NewTaskItem == NULL)
621 {
622 FoundTaskItem = TaskItem;
623 }
624
625 if (--dwTaskCount == 0)
626 {
627 /* We found the last task item in the group! */
628 break;
629 }
630 }
631
632 TaskItem++;
633 }
634
635 return FoundTaskItem;
636 }
637
639 {
640 PTASK_GROUP TaskGroup;
641 PTASK_ITEM LastTaskItem;
642
643 /* NOTE: This routine assumes that the group is *not* collapsed! */
644
645 TaskGroup = TaskItem->Group;
647 {
648 if (TaskGroup != NULL)
649 {
650 ASSERT(TaskGroup->Index < 0);
651 ASSERT(!TaskGroup->IsCollapsed);
652
653 if (TaskGroup->dwTaskCount > 1)
654 {
655 LastTaskItem = FindLastTaskItemOfGroup(TaskGroup, TaskItem);
656 if (LastTaskItem != NULL)
657 {
658 /* Since the group is expanded the task items must have an index */
659 ASSERT(LastTaskItem->Index >= 0);
660
661 return LastTaskItem->Index + 1;
662 }
663 }
664 }
665 else
666 {
667 /* Find the last NULL group button. NULL groups are added at the end of the
668 task item list when grouping is enabled */
669 LastTaskItem = FindLastTaskItemOfGroup(NULL, TaskItem);
670 if (LastTaskItem != NULL)
671 {
672 ASSERT(LastTaskItem->Index >= 0);
673
674 return LastTaskItem->Index + 1;
675 }
676 }
677 }
678
679 return m_ButtonCount;
680 }
681
683 {
684 WCHAR windowText[255];
685 TBBUTTON tbBtn = { 0 };
686 INT iIndex;
687 HICON icon;
688
689 if (TaskItem->Index >= 0)
690 {
691 return UpdateTaskItemButton(TaskItem);
692 }
693
694 if (TaskItem->Group != NULL &&
695 TaskItem->Group->IsCollapsed)
696 {
697 /* The task group is collapsed, we only need to update the group button */
698 return UpdateTaskGroupButton(TaskItem->Group);
699 }
700
701 icon = GetWndIcon(TaskItem->hWnd);
702 if (!icon)
703 icon = static_cast<HICON>(LoadImageW(NULL, MAKEINTRESOURCEW(OIC_SAMPLE), IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE));
704 TaskItem->IconIndex = ImageList_ReplaceIcon(m_ImageList, -1, icon);
705
706 tbBtn.iBitmap = TaskItem->IconIndex;
709 tbBtn.dwData = TaskItem->Index;
710
712 {
713 tbBtn.iString = (DWORD_PTR) windowText;
714 }
715
716 /* Find out where to insert the new button */
717 iIndex = CalculateTaskItemNewButtonIndex(TaskItem);
718 ASSERT(iIndex >= 0);
719 tbBtn.idCommand = iIndex;
720
722
723 if (m_TaskBar.InsertButton(iIndex, &tbBtn))
724 {
725 UpdateIndexesAfter(iIndex, TRUE);
726
727 TRACE("Added button %d for hwnd 0x%p\n", iIndex, TaskItem->hWnd);
728
729 TaskItem->Index = iIndex;
731
732 /* Update button sizes and fix the button wrapping */
734 return iIndex;
735 }
736
738
739 return -1;
740 }
741
743 {
744 PTASK_GROUP TaskGroup;
745 INT iIndex;
746
747 TaskGroup = TaskItem->Group;
748
749 if (TaskItem->Index >= 0)
750 {
751 if ((TaskGroup != NULL && !TaskGroup->IsCollapsed) ||
752 TaskGroup == NULL)
753 {
755
756 RemoveIcon(TaskItem);
757 iIndex = TaskItem->Index;
758 if (m_TaskBar.DeleteButton(iIndex))
759 {
760 TaskItem->Index = -1;
762
763 UpdateIndexesAfter(iIndex, FALSE);
764
765 /* Update button sizes and fix the button wrapping */
767 return TRUE;
768 }
769
771 }
772 }
773
774 return FALSE;
775 }
776
778 {
779 DWORD dwProcessId;
780 PTASK_GROUP TaskGroup, *PrevLink;
781
783 &dwProcessId))
784 {
785 TRACE("Cannot get process id of hwnd 0x%p\n", hWnd);
786 return NULL;
787 }
788
789 /* Try to find an existing task group */
790 TaskGroup = m_TaskGroups;
791 PrevLink = &m_TaskGroups;
792 while (TaskGroup != NULL)
793 {
794 if (TaskGroup->dwProcessId == dwProcessId)
795 {
796 TaskGroup->dwTaskCount++;
797 return TaskGroup;
798 }
799
800 PrevLink = &TaskGroup->Next;
801 TaskGroup = TaskGroup->Next;
802 }
803
804 /* Allocate a new task group */
805 TaskGroup = (PTASK_GROUP) HeapAlloc(hProcessHeap,
807 sizeof(*TaskGroup));
808 if (TaskGroup != NULL)
809 {
810 TaskGroup->dwTaskCount = 1;
811 TaskGroup->dwProcessId = dwProcessId;
812 TaskGroup->Index = -1;
813
814 /* Add the task group to the list */
815 *PrevLink = TaskGroup;
816 }
817
818 return TaskGroup;
819 }
820
822 {
823 PTASK_GROUP TaskGroup, CurrentGroup, *PrevLink;
824
825 TaskGroup = TaskItem->Group;
826 if (TaskGroup != NULL)
827 {
828 DWORD dwNewTaskCount = --TaskGroup->dwTaskCount;
829 if (dwNewTaskCount == 0)
830 {
831 /* Find the previous pointer in the chain */
832 CurrentGroup = m_TaskGroups;
833 PrevLink = &m_TaskGroups;
834 while (CurrentGroup != TaskGroup)
835 {
836 PrevLink = &CurrentGroup->Next;
837 CurrentGroup = CurrentGroup->Next;
838 }
839
840 /* Remove the group from the list */
841 ASSERT(TaskGroup == CurrentGroup);
842 *PrevLink = TaskGroup->Next;
843
844 /* Free the task group */
846 0,
847 TaskGroup);
848 }
849 else if (TaskGroup->IsCollapsed &&
850 TaskGroup->Index >= 0)
851 {
852 if (dwNewTaskCount > 1)
853 {
854 /* FIXME: Check if we should expand the group */
855 /* Update the task group button */
856 UpdateTaskGroupButton(TaskGroup);
857 }
858 else
859 {
860 /* Expand the group of one task button to a task button */
861 ExpandTaskGroup(TaskGroup);
862 }
863 }
864 }
865 }
866
868 {
869 PTASK_ITEM TaskItem, LastItem;
870
871 TaskItem = m_TaskItems;
872 LastItem = TaskItem + m_TaskItemCount;
873 while (TaskItem != LastItem)
874 {
875 if (TaskItem->hWnd == hWnd)
876 return TaskItem;
877
878 TaskItem++;
879 }
880
881 return NULL;
882 }
883
885 {
886 PTASK_ITEM LastItem, TaskItem;
887 PTASK_GROUP TaskGroup;
888 DWORD dwProcessId;
889
890 if (!GetWindowThreadProcessId(hWnd, &dwProcessId))
891 {
892 return NULL;
893 }
894
895 /* Try to find another task that belongs to the same
896 process as the given window */
897 TaskItem = m_TaskItems;
898 LastItem = TaskItem + m_TaskItemCount;
899 while (TaskItem != LastItem)
900 {
901 TaskGroup = TaskItem->Group;
902 if (TaskGroup != NULL)
903 {
904 if (TaskGroup->dwProcessId == dwProcessId)
905 return TaskItem;
906 }
907 else
908 {
909 DWORD dwProcessIdTask;
910
911 if (GetWindowThreadProcessId(TaskItem->hWnd,
912 &dwProcessIdTask) &&
913 dwProcessIdTask == dwProcessId)
914 {
915 return TaskItem;
916 }
917 }
918
919 TaskItem++;
920 }
921
922 return NULL;
923 }
924
926 {
928 {
929 /* We need the most significant bit in 16 bit command IDs to indicate whether it
930 is a task group or task item. WM_COMMAND limits command IDs to 16 bits! */
931 return NULL;
932 }
933
935
936 if (m_TaskItemCount == 0)
937 {
939 0,
941 if (m_TaskItems != NULL)
942 {
944 }
945 else
946 return NULL;
947 }
949 {
950 PTASK_ITEM NewArray;
951 SIZE_T NewArrayLength, ActiveTaskItemIndex;
952
954
956 0,
958 NewArrayLength * sizeof(*m_TaskItems));
959 if (NewArray != NULL)
960 {
961 if (m_ActiveTaskItem != NULL)
962 {
963 /* Fixup the ActiveTaskItem pointer */
964 ActiveTaskItemIndex = m_ActiveTaskItem - m_TaskItems;
965 m_ActiveTaskItem = NewArray + ActiveTaskItemIndex;
966 }
967 m_AllocatedTaskItems = (WORD) NewArrayLength;
968 m_TaskItems = NewArray;
969 }
970 else
971 return NULL;
972 }
973
974 return m_TaskItems + m_TaskItemCount++;
975 }
976
978 {
979 WORD wIndex;
980
981 if (TaskItem == m_ActiveTaskItem)
983
984 wIndex = (WORD) (TaskItem - m_TaskItems);
985 if (wIndex + 1 < m_TaskItemCount)
986 {
987 MoveMemory(TaskItem,
988 TaskItem + 1,
989 (m_TaskItemCount - wIndex - 1) * sizeof(*TaskItem));
990 }
991
993 }
994
996 {
997 if (!m_IsDestroying)
998 {
999 /* Delete the task button from the toolbar */
1000 DeleteTaskItemButton(TaskItem);
1001 }
1002
1003 /* Remove the task from it's group */
1004 RemoveTaskFromTaskGroup(TaskItem);
1005
1006 /* Free the task item */
1007 FreeTaskItem(TaskItem);
1008 }
1009
1011 {
1012 PTASK_ITEM CurrentTaskItem;
1013 PTASK_GROUP TaskGroup = NULL;
1014
1015 CurrentTaskItem = m_ActiveTaskItem;
1016
1017 if (TaskItem != NULL)
1018 TaskGroup = TaskItem->Group;
1019
1020 if (m_IsGroupingEnabled &&
1021 TaskGroup != NULL &&
1022 TaskGroup->IsCollapsed)
1023 {
1024 /* FIXME */
1025 return;
1026 }
1027
1028 if (CurrentTaskItem != NULL)
1029 {
1030 PTASK_GROUP CurrentTaskGroup;
1031
1032 if (CurrentTaskItem == TaskItem)
1033 return;
1034
1035 CurrentTaskGroup = CurrentTaskItem->Group;
1036
1037 if (m_IsGroupingEnabled &&
1038 CurrentTaskGroup != NULL &&
1039 CurrentTaskGroup->IsCollapsed)
1040 {
1041 if (CurrentTaskGroup == TaskGroup)
1042 return;
1043
1044 /* FIXME */
1045 }
1046 else
1047 {
1049 if (CurrentTaskItem->Index >= 0)
1050 {
1051 UpdateTaskItemButton(CurrentTaskItem);
1052 }
1053 }
1054 }
1055
1056 m_ActiveTaskItem = TaskItem;
1057
1058 if (TaskItem != NULL && TaskItem->Index >= 0)
1059 {
1060 UpdateTaskItemButton(TaskItem);
1061 }
1062 else if (TaskItem == NULL)
1063 {
1064 TRACE("Active TaskItem now NULL\n");
1065 }
1066 }
1067
1069 {
1070 PTASK_ITEM TaskItem, LastItem;
1071
1072 TaskItem = m_TaskItems;
1073 LastItem = TaskItem + m_TaskItemCount;
1074 while (TaskItem != LastItem)
1075 {
1076 if (TaskItem->Index == Index)
1077 return TaskItem;
1078
1079 TaskItem++;
1080 }
1081
1082 return NULL;
1083 }
1084
1086 {
1087 PTASK_GROUP CurrentGroup;
1088
1089 CurrentGroup = m_TaskGroups;
1090 while (CurrentGroup != NULL)
1091 {
1092 if (CurrentGroup->Index == Index)
1093 break;
1094
1095 CurrentGroup = CurrentGroup->Next;
1096 }
1097
1098 return CurrentGroup;
1099 }
1100
1102 {
1103 PTASK_ITEM TaskItem;
1104
1105 if (!::IsWindow(hWnd) || m_Tray->IsSpecialHWND(hWnd))
1106 return FALSE;
1107
1108 TaskItem = FindTaskItem(hWnd);
1109 if (TaskItem == NULL)
1110 {
1111 TRACE("Add window 0x%p\n", hWnd);
1112 TaskItem = AllocTaskItem();
1113 if (TaskItem != NULL)
1114 {
1115 ZeroMemory(TaskItem, sizeof(*TaskItem));
1116 TaskItem->hWnd = hWnd;
1117 TaskItem->Index = -1;
1118 TaskItem->Group = AddToTaskGroup(hWnd);
1119
1120 if (!m_IsDestroying)
1121 {
1122 AddTaskItemButton(TaskItem);
1123 }
1124 }
1125 }
1126
1127 return TaskItem != NULL;
1128 }
1129
1131 {
1132 if (TaskItem != NULL)
1133 {
1134 TRACE("Activate window 0x%p on button %d\n", TaskItem->hWnd, TaskItem->Index);
1135 }
1136
1137 CheckActivateTaskItem(TaskItem);
1138 return FALSE;
1139 }
1140
1142 {
1143 PTASK_ITEM TaskItem;
1144
1145 if (!hWnd)
1146 {
1147 return ActivateTaskItem(NULL);
1148 }
1149
1150 TaskItem = FindTaskItem(hWnd);
1151 if (TaskItem == NULL)
1152 {
1153 TaskItem = FindOtherTaskItem(hWnd);
1154 }
1155
1156 if (TaskItem == NULL)
1157 {
1158 WARN("Activate window 0x%p, could not find task\n", hWnd);
1160 }
1161
1162 return ActivateTaskItem(TaskItem);
1163 }
1164
1166 {
1167 PTASK_ITEM TaskItem;
1168
1169 TaskItem = FindTaskItem(hWnd);
1170 if (TaskItem != NULL)
1171 {
1172 TRACE("Delete window 0x%p on button %d\n", hWnd, TaskItem->Index);
1173 DeleteTaskItem(TaskItem);
1174 return TRUE;
1175 }
1176 //else
1177 //TRACE("Failed to delete window 0x%p\n", hWnd);
1178
1179 return FALSE;
1180 }
1181
1183 {
1184 PTASK_ITEM CurrentTask;
1185
1186 if (m_TaskItemCount > 0)
1187 {
1188 CurrentTask = m_TaskItems + m_TaskItemCount;
1189 do
1190 {
1191 DeleteTaskItem(--CurrentTask);
1192 } while (CurrentTask != m_TaskItems);
1193 }
1194 }
1195
1197 {
1198 TaskItem->RenderFlashed = 1;
1199 UpdateTaskItemButton(TaskItem);
1200 }
1201
1203 {
1204 PTASK_ITEM TaskItem;
1205
1206 TaskItem = FindTaskItem(hWnd);
1207 if (TaskItem != NULL)
1208 {
1209 TRACE("Flashing window 0x%p on button %d\n", hWnd, TaskItem->Index);
1210 FlashTaskItem(TaskItem);
1211 return TRUE;
1212 }
1213
1214 return FALSE;
1215 }
1216
1218 {
1219 PTASK_GROUP TaskGroup;
1220
1221 TaskGroup = TaskItem->Group;
1222 if (m_IsGroupingEnabled && TaskGroup != NULL)
1223 {
1224 if (TaskGroup->IsCollapsed && TaskGroup->Index >= 0)
1225 {
1226 UpdateTaskGroupButton(TaskGroup);
1227 }
1228 else if (TaskItem->Index >= 0)
1229 {
1230 goto UpdateTaskItem;
1231 }
1232 }
1233 else if (TaskItem->Index >= 0)
1234 {
1235 UpdateTaskItem:
1236 TaskItem->RenderFlashed = 0;
1237 UpdateTaskItemButton(TaskItem);
1238 }
1239 }
1240
1241
1243 {
1244 PTASK_ITEM TaskItem;
1245
1246 TaskItem = FindTaskItem(hWnd);
1247 if (TaskItem != NULL)
1248 {
1249 RedrawTaskItem(TaskItem);
1250 return TRUE;
1251 }
1252
1253 return FALSE;
1254 }
1255
1257 {
1258 RECT rcClient;
1259 UINT uiRows, uiMax, uiMin, uiBtnsPerLine, ui;
1260 LONG NewBtnSize;
1261 BOOL Horizontal;
1262
1263 /* Update the size of the image list if needed */
1264 int cx, cy;
1268 {
1272
1273 /* SetIconSize removes all icons so we have to reinsert them */
1274 PTASK_ITEM TaskItem = m_TaskItems;
1275 PTASK_ITEM LastTaskItem = m_TaskItems + m_TaskItemCount;
1276 while (TaskItem != LastTaskItem)
1277 {
1278 TaskItem->IconIndex = -1;
1279 UpdateTaskItemButton(TaskItem);
1280
1281 TaskItem++;
1282 }
1283 m_TaskBar.SetImageList(m_ImageList);
1284 }
1285
1286 if (GetClientRect(&rcClient) && !IsRectEmpty(&rcClient))
1287 {
1288 if (m_ButtonCount > 0)
1289 {
1290 Horizontal = m_Tray->IsHorizontal();
1291
1292 if (Horizontal)
1293 {
1294 TBMETRICS tbm = { 0 };
1295 tbm.cbSize = sizeof(tbm);
1297 m_TaskBar.GetMetrics(&tbm);
1298
1299 if (m_ButtonSize.cy + tbm.cyButtonSpacing != 0)
1300 uiRows = (rcClient.bottom + tbm.cyButtonSpacing) / (m_ButtonSize.cy + tbm.cyButtonSpacing);
1301 else
1302 uiRows = 1;
1303
1304 if (uiRows == 0)
1305 uiRows = 1;
1306
1307 uiBtnsPerLine = (m_ButtonCount + uiRows - 1) / uiRows;
1308 }
1309 else
1310 {
1311 uiBtnsPerLine = 1;
1312 uiRows = m_ButtonCount;
1313 }
1314
1315 if (!bRedrawDisabled)
1317
1318 /* We might need to update the button spacing */
1319 int cxButtonSpacing = m_TaskBar.UpdateTbButtonSpacing(
1320 Horizontal, m_Theme != NULL,
1321 uiRows, uiBtnsPerLine);
1322
1323 /* Determine the minimum and maximum width of a button */
1325 if (Horizontal)
1326 {
1328
1329 /* Calculate the ideal width and make sure it's within the allowed range */
1330 NewBtnSize = (rcClient.right - (uiBtnsPerLine * cxButtonSpacing)) / uiBtnsPerLine;
1331
1332 if (NewBtnSize < (LONG) uiMin)
1333 NewBtnSize = uiMin;
1334 if (NewBtnSize >(LONG)uiMax)
1335 NewBtnSize = uiMax;
1336
1337 /* Recalculate how many buttons actually fit into one line */
1338 uiBtnsPerLine = rcClient.right / (NewBtnSize + cxButtonSpacing);
1339 if (uiBtnsPerLine == 0)
1340 uiBtnsPerLine++;
1341 }
1342 else
1343 {
1344 NewBtnSize = uiMax = rcClient.right;
1345 }
1346
1347 m_ButtonSize.cx = NewBtnSize;
1348
1349 m_ButtonsPerLine = uiBtnsPerLine;
1350
1351 for (ui = 0; ui != m_ButtonCount; ui++)
1352 {
1353 TBBUTTONINFOW tbbi = { 0 };
1354 tbbi.cbSize = sizeof(tbbi);
1356 tbbi.cx = (INT) NewBtnSize;
1357 tbbi.fsState = TBSTATE_ENABLED;
1358
1359 /* Check if we're updating a button that is the last one in the
1360 line. If so, we need to set the TBSTATE_WRAP flag! */
1361 if (Horizontal)
1362 {
1363 if ((ui + 1) % uiBtnsPerLine == 0)
1364 tbbi.fsState |= TBSTATE_WRAP;
1365 }
1366 else
1367 {
1368 tbbi.fsState |= TBSTATE_WRAP;
1369 }
1370
1371 if (m_ActiveTaskItem != NULL &&
1373 {
1374 tbbi.fsState |= TBSTATE_CHECKED;
1375 }
1376
1377 m_TaskBar.SetButtonInfo(ui, &tbbi);
1378 }
1379 }
1380 else
1381 {
1382 m_ButtonsPerLine = 0;
1383 m_ButtonSize.cx = 0;
1384 }
1385 }
1386
1387 // FIXME: This seems to be enabling redraws prematurely, but moving it to its right place doesn't work!
1389 }
1390
1392 {
1393 if (m_Tray->IsTaskWnd(hWnd))
1394 {
1395 TRACE("Adding task for %p...\n", hWnd);
1396 AddTask(hWnd);
1397 }
1398 return TRUE;
1399 }
1400
1402 {
1404
1405 return This->EnumWindowsProc(hWnd);
1406 }
1407
1409 {
1410 TRACE("Refreshing window list...\n");
1411 /* Add all windows to the toolbar */
1412 return EnumWindows(s_EnumWindowsProc, (LPARAM)this);
1413 }
1414
1416 {
1417 TRACE("OmThemeChanged\n");
1418
1419 if (m_Theme)
1421
1422 if (IsThemeActive())
1423 m_Theme = OpenThemeData(m_hWnd, L"TaskBand");
1424 else
1425 m_Theme = NULL;
1426
1427 return TRUE;
1428 }
1429
1431 {
1433 return FALSE;
1434
1435 SetWindowTheme(m_TaskBar.m_hWnd, L"TaskBand", NULL);
1436
1439 ILC_COLOR32 | ILC_MASK, 0, 1000);
1440 m_TaskBar.SetImageList(m_ImageList);
1441
1442 /* Set proper spacing between buttons */
1443 m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL);
1444
1445 /* Register the shell hook */
1447
1448 TRACE("ShellHookMsg got assigned number %d\n", m_ShellHookMsg);
1449
1450 RegisterShellHook(m_hWnd, 3); /* 1 if no NT! We're targeting NT so we don't care! */
1451
1453
1454 /* Recalculate the button size */
1456
1457#if DUMP_TASKS != 0
1458 SetTimer(hwnd, 1, 5000, NULL);
1459#endif
1460 return TRUE;
1461 }
1462
1464 {
1466
1467 /* Unregister the shell hook */
1469
1472 return TRUE;
1473 }
1474
1475 VOID SendPulseToTray(BOOL bDelete, HWND hwndActive)
1476 {
1477 HWND hwndTray = m_Tray->GetHWND();
1478 ::SendMessage(hwndTray, TWM_PULSE, bDelete, (LPARAM)hwndActive);
1479 }
1480
1482 {
1483 BOOL bResult = FALSE;
1484 WCHAR szBuf[MAX_PATH * 2];
1485 wsprintfW(szBuf, L"%s\\AppKey\\%u", REGSTR_PATH_EXPLORER, uAppCmd);
1486 HUSKEY hKey;
1488 return bResult;
1489
1490 DWORD cb = sizeof(szBuf);
1491 if (!bResult && SHRegQueryUSValueW(hKey, L"ShellExecute", NULL, szBuf, &cb, FALSE, NULL, 0) == ERROR_SUCCESS)
1492 {
1493 bResult = TRUE;
1494 }
1495 cb = sizeof(szBuf);
1496 if (!bResult && SHRegQueryUSValueW(hKey, L"Association", NULL, szBuf, &cb, FALSE, NULL, 0) == ERROR_SUCCESS)
1497 {
1498 bResult = TRUE;
1499 cb = _countof(szBuf);
1501 *szBuf = UNICODE_NULL;
1502 }
1503 cb = sizeof(szBuf);
1504 if (!bResult && SHRegQueryUSValueW(hKey, L"RegisteredApp", NULL, szBuf, &cb, FALSE, NULL, 0) == ERROR_SUCCESS)
1505 {
1506 bResult = TRUE;
1508 *szBuf = UNICODE_NULL; // Don't execute again
1509 }
1511
1512 // Note: Tweak UI uses an empty string for its "Do nothing" option.
1513 if (bResult && *szBuf)
1515 return bResult;
1516 }
1517
1519 {
1520 const UINT uAppCmd = GET_APPCOMMAND_LPARAM(lParam);
1521 if (InvokeRegistryAppKeyCommand(uAppCmd))
1522 return TRUE;
1523 switch (uAppCmd)
1524 {
1525 case APPCOMMAND_VOLUME_MUTE:
1526 case APPCOMMAND_VOLUME_DOWN:
1527 case APPCOMMAND_VOLUME_UP:
1528 // TODO: Try IMMDeviceEnumerator::GetDefaultAudioEndpoint first and then fall back to mixer.
1529 FIXME("Call the mixer API to change the global volume\n");
1530 return TRUE;
1531 case APPCOMMAND_BROWSER_SEARCH:
1532 return SHFindFiles(NULL, NULL);
1533 }
1534 return FALSE;
1535 }
1536
1538 {
1539 BOOL Ret = FALSE;
1540
1541 /* In case the shell hook wasn't registered properly, ignore WM_NULLs*/
1542 if (uMsg == 0)
1543 {
1544 bHandled = FALSE;
1545 return 0;
1546 }
1547
1548 TRACE("Received shell hook message: wParam=%08lx, lParam=%08lx\n", wParam, lParam);
1549
1550 switch ((INT) wParam)
1551 {
1552 case HSHELL_APPCOMMAND:
1553 Ret = HandleAppCommand(0, lParam);
1554 break;
1555
1558 AddTask((HWND) lParam);
1559 break;
1560
1562 /* The window still exists! Delay destroying it a bit */
1565 break;
1566
1568 case HSHELL_WINDOWACTIVATED:
1571 break;
1572
1573 case HSHELL_FLASH:
1575 break;
1576
1577 case HSHELL_REDRAW:
1579 break;
1580
1581 case HSHELL_TASKMAN:
1582 ::PostMessage(m_Tray->GetHWND(), TWM_OPENSTARTMENU, 0, 0);
1583 break;
1584
1586 ::SwitchToThisWindow(m_Tray->GetHWND(), TRUE);
1587 ::SetForegroundWindow(m_Tray->GetHWND());
1588 break;
1589
1590 case HSHELL_LANGUAGE:
1591 case HSHELL_SYSMENU:
1592 case HSHELL_ENDTASK:
1593 case HSHELL_ACCESSIBILITYSTATE:
1594 case HSHELL_WINDOWREPLACED:
1595 case HSHELL_WINDOWREPLACING:
1596
1597 case HSHELL_GETMINRECT:
1598 default:
1599 {
1600#if DEBUG_SHELL_HOOK
1601 int i, found;
1602 for (i = 0, found = 0; i != _countof(hshell_msg); i++)
1603 {
1604 if (hshell_msg[i].msg == (INT) wParam)
1605 {
1606 TRACE("Shell message %ws unhandled (lParam = 0x%p)!\n", hshell_msg[i].msg_name, lParam);
1607 found = 1;
1608 break;
1609 }
1610 }
1611 if (found)
1612 break;
1613#endif
1614 TRACE("Shell message %d unhandled (lParam = 0x%p)!\n", (INT) wParam, lParam);
1615 break;
1616 }
1617 }
1618
1619 return Ret;
1620 }
1621
1623 {
1624 BOOL bIsMinimized;
1625 BOOL bIsActive;
1626
1627 if (::IsWindow(TaskItem->hWnd))
1628 {
1629 bIsMinimized = ::IsIconic(TaskItem->hWnd);
1630 bIsActive = (TaskItem == m_ActiveTaskItem);
1631
1632 TRACE("Active TaskItem %p, selected TaskItem %p\n", m_ActiveTaskItem, TaskItem);
1633 if (m_ActiveTaskItem)
1634 TRACE("Active TaskItem hWnd=%p, TaskItem hWnd %p\n", m_ActiveTaskItem->hWnd, TaskItem->hWnd);
1635
1636 TRACE("Valid button clicked. HWND=%p, IsMinimized=%s, IsActive=%s...\n",
1637 TaskItem->hWnd, bIsMinimized ? "Yes" : "No", bIsActive ? "Yes" : "No");
1638
1639 if (!bIsMinimized && bIsActive)
1640 {
1641 if (!::IsHungAppWindow(TaskItem->hWnd))
1642 ::ShowWindowAsync(TaskItem->hWnd, SW_MINIMIZE);
1643 TRACE("Valid button clicked. App window Minimized.\n");
1644 }
1645 else
1646 {
1647 ::SwitchToThisWindow(TaskItem->hWnd, TRUE);
1648
1649 TRACE("Valid button clicked. App window Restored.\n");
1650 }
1651 }
1652 }
1653
1655 {
1656 /* TODO: Show task group menu */
1657 }
1658
1660 {
1661 PTASK_ITEM TaskItem;
1662 PTASK_GROUP TaskGroup;
1663
1665 {
1666 TaskGroup = FindTaskGroupByIndex((INT) wIndex);
1667 if (TaskGroup != NULL && TaskGroup->IsCollapsed)
1668 {
1669 HandleTaskGroupClick(TaskGroup);
1670 return TRUE;
1671 }
1672 }
1673
1674 TaskItem = FindTaskItemByIndex((INT) wIndex);
1675 if (TaskItem != NULL)
1676 {
1677 SendPulseToTray(FALSE, TaskItem->hWnd);
1678 HandleTaskItemClick(TaskItem);
1679 return TRUE;
1680 }
1681
1682 return FALSE;
1683 }
1684
1685 static VOID CALLBACK
1687 {
1688 ::PostMessageW(hwnd, WM_NULL, 0, 0);
1689 }
1690
1692 {
1693 POINT pt;
1694 GetCursorPos(&pt);
1695
1696 SetForegroundWindow(TaskItem->hWnd);
1697
1698 ActivateTask(TaskItem->hWnd);
1699
1700 if (GetForegroundWindow() != TaskItem->hWnd)
1701 ERR("HandleTaskItemRightClick detected the window did not become foreground\n");
1702
1703 ::SendMessageCallbackW(TaskItem->hWnd, WM_POPUPSYSTEMMENU, 0, MAKELPARAM(pt.x, pt.y),
1704 SendAsyncProc, (ULONG_PTR)TaskItem);
1705 }
1706
1708 {
1709 /* TODO: Show task group right click menu */
1710 }
1711
1713 {
1714 PTASK_ITEM TaskItem;
1715 PTASK_GROUP TaskGroup;
1717 {
1718 TaskGroup = FindTaskGroupByIndex((INT) wIndex);
1719 if (TaskGroup != NULL && TaskGroup->IsCollapsed)
1720 {
1721 HandleTaskGroupRightClick(TaskGroup);
1722 return TRUE;
1723 }
1724 }
1725
1726 TaskItem = FindTaskItemByIndex((INT) wIndex);
1727
1728 if (TaskItem != NULL)
1729 {
1730 HandleTaskItemRightClick(TaskItem);
1731 return TRUE;
1732 }
1733
1734 return FALSE;
1735 }
1736
1737
1739 {
1740 LRESULT Ret = CDRF_DODEFAULT;
1741 PTASK_GROUP TaskGroup;
1742 PTASK_ITEM TaskItem;
1743
1744 TaskItem = FindTaskItemByIndex((INT) nmtbcd->nmcd.dwItemSpec);
1745 TaskGroup = FindTaskGroupByIndex((INT) nmtbcd->nmcd.dwItemSpec);
1746 if (TaskGroup == NULL && TaskItem != NULL)
1747 {
1748 ASSERT(TaskItem != NULL);
1749
1750 if (TaskItem != NULL && ::IsWindow(TaskItem->hWnd))
1751 {
1752 /* Make the entire button flashing if necessary */
1753 if (nmtbcd->nmcd.uItemState & CDIS_MARKED)
1754 {
1755 Ret = TBCDRF_NOBACKGROUND;
1756 if (!m_Theme)
1757 {
1758 SelectObject(nmtbcd->nmcd.hdc, GetSysColorBrush(COLOR_HIGHLIGHT));
1759 Rectangle(nmtbcd->nmcd.hdc,
1760 nmtbcd->nmcd.rc.left,
1761 nmtbcd->nmcd.rc.top,
1762 nmtbcd->nmcd.rc.right,
1763 nmtbcd->nmcd.rc.bottom);
1764 }
1765 else
1766 {
1767 DrawThemeBackground(m_Theme, nmtbcd->nmcd.hdc, TDP_FLASHBUTTON, 0, &nmtbcd->nmcd.rc, 0);
1768 }
1769 nmtbcd->clrText = GetSysColor(COLOR_HIGHLIGHTTEXT);
1770 return Ret;
1771 }
1772 }
1773 }
1774 else if (TaskGroup != NULL)
1775 {
1776 /* FIXME: Implement painting for task groups */
1777 }
1778 return Ret;
1779 }
1780
1782 {
1783 LRESULT Ret = 0;
1784
1785 switch (nmh->code)
1786 {
1787 case NM_CUSTOMDRAW:
1788 {
1789 LPNMTBCUSTOMDRAW nmtbcd = (LPNMTBCUSTOMDRAW) nmh;
1790
1791 switch (nmtbcd->nmcd.dwDrawStage)
1792 {
1793
1794 case CDDS_ITEMPREPAINT:
1795 Ret = HandleItemPaint(nmtbcd);
1796 break;
1797
1798 case CDDS_PREPAINT:
1799 Ret = CDRF_NOTIFYITEMDRAW;
1800 break;
1801
1802 default:
1803 Ret = CDRF_DODEFAULT;
1804 break;
1805 }
1806 break;
1807 }
1808 }
1809
1810 return Ret;
1811 }
1812
1814 {
1815 HDC hdc = (HDC) wParam;
1816
1817 if (!IsAppThemed())
1818 {
1819 bHandled = FALSE;
1820 return 0;
1821 }
1822
1823 RECT rect;
1826
1827 return TRUE;
1828 }
1829
1831 {
1832 SIZE szClient;
1833
1834 szClient.cx = LOWORD(lParam);
1835 szClient.cy = HIWORD(lParam);
1836 if (m_TaskBar.m_hWnd != NULL)
1837 {
1838 m_TaskBar.SetWindowPos(NULL, 0, 0, szClient.cx, szClient.cy, SWP_NOZORDER);
1839
1841 }
1842 return TRUE;
1843 }
1844
1846 {
1847 LRESULT Ret = TRUE;
1848 /* We want the tray window to be draggable everywhere, so make the control
1849 appear transparent */
1850 Ret = DefWindowProc(uMsg, wParam, lParam);
1851 if (Ret != HTVSCROLL && Ret != HTHSCROLL)
1852 Ret = HTTRANSPARENT;
1853 return Ret;
1854 }
1855
1857 {
1858 LRESULT Ret = TRUE;
1859 if (lParam != 0 && (HWND) lParam == m_TaskBar.m_hWnd)
1860 {
1862 }
1863 return Ret;
1864 }
1865
1867 {
1868 LRESULT Ret = TRUE;
1869 const NMHDR *nmh = (const NMHDR *) lParam;
1870
1871 if (nmh->hwndFrom == m_TaskBar.m_hWnd)
1872 {
1873 Ret = HandleToolbarNotification(nmh);
1874 }
1875 return Ret;
1876 }
1877
1879 {
1880 /* Update the button spacing */
1881 m_TaskBar.UpdateTbButtonSpacing(m_Tray->IsHorizontal(), m_Theme != NULL);
1882 return TRUE;
1883 }
1884
1886 {
1887 BOOL bSettingsChanged = FALSE;
1888 TaskbarSettings* newSettings = (TaskbarSettings*)lParam;
1889
1890 if (newSettings->bGroupButtons != g_TaskbarSettings.bGroupButtons)
1891 {
1892 bSettingsChanged = TRUE;
1895 }
1896
1897 if (newSettings->bSmallIcons != g_TaskbarSettings.bSmallIcons)
1898 {
1899 bSettingsChanged = TRUE;
1901 }
1902
1903 if (bSettingsChanged)
1904 {
1905 /* Refresh each task item view */
1908 }
1909
1910 return 0;
1911 }
1912
1914 {
1915 LRESULT Ret = 0;
1916 INT_PTR iBtn = -1;
1917
1918 if (m_TaskBar.m_hWnd != NULL)
1919 {
1920 POINT pt;
1921
1922 pt.x = GET_X_LPARAM(lParam);
1923 pt.y = GET_Y_LPARAM(lParam);
1924
1926
1927 iBtn = m_TaskBar.HitTest(&pt);
1928 if (iBtn >= 0)
1929 {
1931 }
1932 }
1933 if (iBtn < 0)
1934 {
1935 /* Not on a taskbar button, so forward message to tray */
1936 Ret = SendMessage(m_Tray->GetHWND(), uMsg, wParam, lParam);
1937 }
1938 return Ret;
1939 }
1940
1942 {
1943 PTASK_ITEM TaskItem = FindTaskItem((HWND) wParam);
1944 if (TaskItem)
1945 {
1946 RECT* prcMinRect = (RECT*) lParam;
1947 RECT rcItem, rcToolbar;
1948 m_TaskBar.GetItemRect(TaskItem->Index, &rcItem);
1949 m_TaskBar.GetWindowRect(&rcToolbar);
1950
1951 OffsetRect(&rcItem, rcToolbar.left, rcToolbar.top);
1952
1953 *prcMinRect = rcItem;
1954 return TRUE;
1955 }
1956 return FALSE;
1957 }
1958
1960 {
1961 return MA_NOACTIVATE;
1962 }
1963
1965 {
1966#if DUMP_TASKS != 0
1967 switch (wParam)
1968 {
1969 case 1:
1970 DumpTasks();
1971 break;
1972 }
1973#endif
1974 return TRUE;
1975 }
1976
1978 {
1979 return m_TaskBar.SendMessageW(uMsg, wParam, lParam);
1980 }
1981
1983 {
1984 if (wParam == SPI_SETNONCLIENTMETRICS)
1985 {
1986 /* Don't update the font, this will be done when we get a WM_SETFONT from our parent */
1988 }
1989
1990 return 0;
1991 }
1992
1994 {
1996 if (cpData->dwData == m_uHardErrorMsg)
1997 {
1998 /* A hard error balloon message */
2000 ERR("Got balloon data 0x%x, 0x%x, '%S', '%S'\n", pData->Status, pData->dwType, (WCHAR*)((ULONG_PTR)pData + pData->TitleOffset), (WCHAR*)((ULONG_PTR)pData + pData->MessageOffset));
2001 if (pData->cbHeaderSize == sizeof(BALLOON_HARD_ERROR_DATA))
2003 return TRUE;
2004 }
2005
2006 return FALSE;
2007 }
2008
2010 {
2011 m_Tray = tray;
2014 if (!m_hWnd)
2015 return E_FAIL;
2016 return S_OK;
2017 }
2018
2019 // *** IOleWindow methods ***
2020
2022 GetWindow(HWND* phwnd) override
2023 {
2024 if (!phwnd)
2025 return E_INVALIDARG;
2026 *phwnd = m_hWnd;
2027 return S_OK;
2028 }
2029
2031 ContextSensitiveHelp(BOOL fEnterMode) override
2032 {
2033 return E_NOTIMPL;
2034 }
2035
2037
2039 MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged)
2057 END_MSG_MAP()
2058
2060
2064 END_COM_MAP()
2065};
2066
2068{
2069 return ShellObjectCreatorInit<CTaskSwitchWnd>(hWndParent, Tray, riid, ppv);
2070}
WCHAR windowText[1024]
Definition: appswitch.c:49
#define InterlockedExchange
Definition: armddk.h:54
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
@ Create
Definition: registry.c:563
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define TWM_OPENSTARTMENU
Definition: precomp.h:133
#define TSWM_UPDATETASKBARPOS
Definition: precomp.h:395
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
#define TWM_PULSE
Definition: precomp.h:135
#define TWM_SETTINGSCHANGED
Definition: precomp.h:134
#define STDMETHODIMP
Definition: basetyps.h:43
BOOL IsIconic() const
Definition: atlwin.h:932
BOOL SetWindowPos(HWND hWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags)
Definition: atlwin.h:1288
BOOL ScreenToClient(LPPOINT lpPoint) const
Definition: atlwin.h:1092
void SetRedraw(BOOL bRedraw=TRUE)
Definition: atlwin.h:1234
BOOL GetWindowRect(LPRECT lpRect) const
Definition: atlwin.h:816
HWND m_hWnd
Definition: atlwin.h:273
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:902
BOOL IsWindow() const
Definition: atlwin.h:947
CStringW m_Title
Definition: taskswnd.cpp:112
static DWORD CALLBACK s_HardErrorThreadProc(IN OUT LPVOID lpParameter)
Definition: taskswnd.cpp:170
CStringW m_Text
Definition: taskswnd.cpp:113
HRESULT ThreadProc()
Definition: taskswnd.cpp:138
void StartThread(PBALLOON_HARD_ERROR_DATA pData)
Definition: taskswnd.cpp:180
BOOL HandleAppCommand(IN WPARAM wParam, IN LPARAM lParam)
Definition: taskswnd.cpp:1518
UINT m_ShellHookMsg
Definition: taskswnd.cpp:307
static BOOL CALLBACK s_EnumWindowsProc(IN HWND hWnd, IN LPARAM lParam)
Definition: taskswnd.cpp:1401
VOID RedrawTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1217
LRESULT OnTaskbarSettingsChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1885
INT UpdateTaskItemButton(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:526
INT GetWndTextFromTaskItem(IN PTASK_ITEM TaskItem, LPWSTR szBuf, DWORD cchBuf)
Definition: taskswnd.cpp:350
LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1866
LRESULT OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1913
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1964
PTASK_ITEM FindOtherTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:884
VOID UpdateButtonsSize(IN BOOL bRedrawDisabled)
Definition: taskswnd.cpp:1256
BOOL HandleButtonClick(IN WORD wIndex)
Definition: taskswnd.cpp:1659
virtual ~CTaskSwitchWnd()
Definition: taskswnd.cpp:348
PTASK_ITEM m_ActiveTaskItem
Definition: taskswnd.cpp:314
VOID ExpandTaskGroup(IN PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:482
PTASK_ITEM m_TaskItems
Definition: taskswnd.cpp:313
STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode) override
Definition: taskswnd.cpp:2031
PTASK_GROUP AddToTaskGroup(IN HWND hWnd)
Definition: taskswnd.cpp:777
VOID RemoveIcon(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:572
CComPtr< ITrayWindow > m_Tray
Definition: taskswnd.cpp:305
VOID CheckActivateTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1010
CTaskToolbar m_TaskBar
Definition: taskswnd.cpp:303
UINT m_uHardErrorMsg
Definition: taskswnd.cpp:327
VOID UpdateIndexesAfter(IN INT iIndex, BOOL bInserted)
Definition: taskswnd.cpp:410
VOID SendPulseToTray(BOOL bDelete, HWND hwndActive)
Definition: taskswnd.cpp:1475
BOOL m_IsDestroying
Definition: taskswnd.cpp:323
VOID FreeTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:977
LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1856
WORD m_ButtonCount
Definition: taskswnd.cpp:318
PTASK_ITEM AllocTaskItem()
Definition: taskswnd.cpp:925
LRESULT OnSettingChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1982
HTHEME m_Theme
Definition: taskswnd.cpp:316
CHardErrorThread m_HardErrorThread
Definition: taskswnd.cpp:328
VOID FlashTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1196
VOID RemoveTaskFromTaskGroup(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:821
BOOL FlashTask(IN HWND hWnd)
Definition: taskswnd.cpp:1202
PTASK_ITEM FindLastTaskItemOfGroup(IN PTASK_GROUP TaskGroup OPTIONAL, IN PTASK_ITEM NewTaskItem OPTIONAL)
Definition: taskswnd.cpp:600
LRESULT OnShellHook(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1537
INT AddTaskItemButton(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:682
LRESULT OnMouseActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1959
BOOL ActivateTask(IN HWND hWnd)
Definition: taskswnd.cpp:1141
INT UpdateTaskGroupButton(IN PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:473
VOID DeleteTaskItem(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:995
BOOL ActivateTaskItem(IN OUT PTASK_ITEM TaskItem OPTIONAL)
Definition: taskswnd.cpp:1130
VOID DeleteAllTasks()
Definition: taskswnd.cpp:1182
BOOL RefreshWindowList()
Definition: taskswnd.cpp:1408
LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1830
BOOL RedrawTask(IN HWND hWnd)
Definition: taskswnd.cpp:1242
PTASK_GROUP m_TaskGroups
Definition: taskswnd.cpp:312
PTASK_GROUP FindTaskGroupByIndex(IN INT Index)
Definition: taskswnd.cpp:1085
BOOL m_IsGroupingEnabled
Definition: taskswnd.cpp:322
LRESULT OnKludgeItemRect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1941
BOOL DeleteTaskItemButton(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:742
HICON GetWndIcon(HWND hwnd)
Definition: taskswnd.cpp:491
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1463
static BOOL InvokeRegistryAppKeyCommand(UINT uAppCmd)
Definition: taskswnd.cpp:1481
VOID HandleTaskGroupRightClick(IN OUT PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:1707
BOOL CALLBACK EnumWindowsProc(IN HWND hWnd)
Definition: taskswnd.cpp:1391
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1430
WORD m_AllocatedTaskItems
Definition: taskswnd.cpp:310
LRESULT OnThemeChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1415
LRESULT OnSetFont(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1977
VOID HandleTaskGroupClick(IN OUT PTASK_GROUP TaskGroup)
Definition: taskswnd.cpp:1654
LRESULT OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1813
PTASK_ITEM FindTaskItem(IN HWND hWnd)
Definition: taskswnd.cpp:867
LRESULT HandleItemPaint(IN OUT NMTBCUSTOMDRAW *nmtbcd)
Definition: taskswnd.cpp:1738
STDMETHODIMP GetWindow(HWND *phwnd) override
Definition: taskswnd.cpp:2022
HIMAGELIST m_ImageList
Definition: taskswnd.cpp:320
PTASK_ITEM FindTaskItemByIndex(IN INT Index)
Definition: taskswnd.cpp:1068
VOID HandleTaskItemClick(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1622
LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1845
static VOID CALLBACK SendAsyncProc(HWND hwnd, UINT uMsg, DWORD_PTR dwData, LRESULT lResult)
Definition: taskswnd.cpp:1686
VOID HandleTaskItemRightClick(IN OUT PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:1691
BOOL DeleteTask(IN HWND hWnd)
Definition: taskswnd.cpp:1165
HRESULT Initialize(IN HWND hWndParent, IN OUT ITrayWindow *tray)
Definition: taskswnd.cpp:2009
INT CalculateTaskItemNewButtonIndex(IN PTASK_ITEM TaskItem)
Definition: taskswnd.cpp:638
LRESULT OnUpdateTaskbarPos(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1878
WORD m_TaskItemCount
Definition: taskswnd.cpp:309
LRESULT OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:1993
LRESULT HandleToolbarNotification(IN const NMHDR *nmh)
Definition: taskswnd.cpp:1781
BOOL HandleButtonRightClick(IN WORD wIndex)
Definition: taskswnd.cpp:1712
UINT m_ButtonsPerLine
Definition: taskswnd.cpp:317
BOOL AddTask(IN HWND hWnd)
Definition: taskswnd.cpp:1101
BOOL SetButtonCommandId(IN INT iButtonIndex, IN INT iCommandId)
Definition: taskswnd.cpp:248
INT UpdateTbButtonSpacing(IN BOOL bHorizontal, IN BOOL bThemed, IN UINT uiRows=0, IN UINT uiBtnsPerLine=0)
Definition: taskswnd.cpp:205
VOID BeginUpdate()
Definition: taskswnd.cpp:237
LRESULT OnNcHitTestToolbar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: taskswnd.cpp:259
VOID EndUpdate()
Definition: taskswnd.cpp:242
BOOL Initialize(HWND hWndParent)
Definition: taskswnd.cpp:284
HWND Create(HWND hWndParent, DWORD dwStyles=0, DWORD dwExStyles=0)
Definition: rosctrls.h:256
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI ImageList_SetIconSize(HIMAGELIST himl, INT cx, INT cy)
Definition: imagelist.c:3132
BOOL WINAPI ImageList_Remove(HIMAGELIST himl, INT i)
Definition: imagelist.c:2628
INT WINAPI ImageList_ReplaceIcon(HIMAGELIST himl, INT nIndex, HICON hIcon)
Definition: imagelist.c:2839
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2055
#define CloseHandle
Definition: compat.h:739
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:65
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
BOOL WINAPI TerminateThread(IN HANDLE hThread, IN DWORD dwExitCode)
Definition: thread.c:587
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSKey, PHUSKEY phNewUSKey, BOOL fIgnoreHKCU)
Definition: reg.c:123
LONG WINAPI SHRegCloseUSKey(HUSKEY hUSKey)
Definition: reg.c:190
LONG WINAPI SHRegQueryUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData, BOOL fIgnoreHKCU, LPVOID pvDefaultData, DWORD dwDefaultDataSize)
Definition: reg.c:504
EXTERN_C HRESULT WINAPI SHRunIndirectRegClientCommand(_In_opt_ HWND hWnd, _In_ PCWSTR pszClientType)
Definition: utils.cpp:265
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:850
BOOL WINAPI IsThemeActive(void)
Definition: system.c:621
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:965
BOOL WINAPI IsAppThemed(void)
Definition: system.c:611
#define pt(x, y)
Definition: drawing.c:79
#define ULONG_PTR
Definition: config.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
FxAutoRegKey hKey
GLintptr offset
Definition: glext.h:5920
GLuint index
Definition: glext.h:6031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
HANDLE hProcessHeap
Definition: kbswitch.c:37
#define BEGIN_COM_MAP(x)
Definition: atlcom.h:581
#define COM_INTERFACE_ENTRY_IID(iid, x)
Definition: atlcom.h:601
#define DECLARE_PROTECT_FINAL_CONSTRUCT()
Definition: atlcom.h:679
#define DECLARE_NOT_AGGREGATABLE(x)
Definition: atlcom.h:651
#define END_COM_MAP()
Definition: atlcom.h:592
#define MESSAGE_HANDLER(msg, func)
Definition: atlwin.h:1926
#define BEGIN_MSG_MAP(theClass)
Definition: atlwin.h:1898
#define END_MSG_MAP()
Definition: atlwin.h:1917
#define DECLARE_WND_CLASS_EX(WndClassName, style, bkgnd)
Definition: atlwin.h:2004
#define ASSERT(a)
Definition: mode.c:44
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static HICON
Definition: imagelist.c:80
static HANDLE ULONG_PTR dwData
Definition: file.c:35
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
HICON hIcon
Definition: msconfig.c:44
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
UINT ui
Definition: oleauto.h:49
const GUID IID_IOleWindow
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_TABSTOP
Definition: pedump.c:634
#define WS_VISIBLE
Definition: pedump.c:620
long LONG
Definition: pedump.c:60
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define INT
Definition: polytest.cpp:20
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define TBIF_SIZE
Definition: commctrl.h:1225
#define BTNS_SHOWTEXT
Definition: commctrl.h:1006
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define TBSTATE_ELLIPSES
Definition: commctrl.h:978
#define TBIF_IMAGE
Definition: commctrl.h:1219
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define TBBUTTONINFO
Definition: commctrl.h:1254
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define TBSTYLE_LIST
Definition: commctrl.h:993
#define CDRF_DODEFAULT
Definition: commctrl.h:268
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ILC_COLOR32
Definition: commctrl.h:358
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define TBCDRF_NOBACKGROUND
Definition: commctrl.h:1040
#define TBSTYLE_TRANSPARENT
Definition: commctrl.h:996
#define CCS_NODIVIDER
Definition: commctrl.h:2253
#define CDIS_MARKED
Definition: commctrl.h:298
#define CCS_TOP
Definition: commctrl.h:2247
#define TBMF_BUTTONSPACING
Definition: commctrl.h:1289
#define TBIF_BYINDEX
Definition: commctrl.h:1226
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define TBIF_TEXT
Definition: commctrl.h:1220
#define ILC_MASK
Definition: commctrl.h:351
#define CCS_NORESIZE
Definition: commctrl.h:2250
#define TBSTATE_WRAP
Definition: commctrl.h:977
#define BTNS_CHECK
Definition: commctrl.h:1000
#define TBSTYLE_WRAPABLE
Definition: commctrl.h:990
#define TBMF_BARPAD
Definition: commctrl.h:1288
#define BTNS_NOPREFIX
Definition: commctrl.h:1005
#define TBSTATE_MARKED
Definition: commctrl.h:979
#define TBIF_COMMAND
Definition: commctrl.h:1224
#define TBSTATE_CHECKED
Definition: commctrl.h:972
struct _NMTBCUSTOMDRAW * LPNMTBCUSTOMDRAW
#define TBIF_STATE
Definition: commctrl.h:1221
#define REFIID
Definition: guiddef.h:118
#define REGSTR_PATH_EXPLORER
Definition: regstr.h:33
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
BOOL WINAPI RegisterShellHook(HWND hWnd, DWORD dwType)
Definition: shellord.c:510
BOOL WINAPI SHFindFiles(PCIDLIST_ABSOLUTE pidlFolder, PCIDLIST_ABSOLUTE pidlSaveFile)
Definition: shellord.c:2468
EXTERN_C VOID WINAPI ShellExec_RunDLLW(_In_opt_ HWND hwnd, _In_opt_ HINSTANCE hInstance, _In_ PCWSTR pszCmdLine, _In_ INT nCmdShow)
Definition: shlexec.cpp:3187
HRESULT hr
Definition: shlfolder.c:183
@ ASSOCSTR_EXECUTABLE
Definition: shlwapi.h:613
#define AssocQueryString
Definition: shlwapi.h:733
@ ASSOCF_NOTRUNCATE
Definition: shlwapi.h:597
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
DWORD dwMask
Definition: commctrl.h:1243
int cyButtonSpacing
Definition: commctrl.h:1299
int cxButtonSpacing
Definition: commctrl.h:1298
int cxBarPad
Definition: commctrl.h:1296
DWORD dwMask
Definition: commctrl.h:1293
int cyBarPad
Definition: commctrl.h:1297
UINT cbSize
Definition: commctrl.h:1292
BOOL bGroupButtons
Definition: precomp.h:219
BOOL bSmallIcons
Definition: precomp.h:223
NMCUSTOMDRAW nmcd
Definition: commctrl.h:1017
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
struct _TASK_GROUP * Next
Definition: taskswnd.cpp:65
DWORD IsCollapsed
Definition: taskswnd.cpp:76
DWORD dwTaskCount
Definition: taskswnd.cpp:67
DWORD dwFlags
Definition: taskswnd.cpp:72
DWORD dwProcessId
Definition: taskswnd.cpp:68
DWORD dwFlags
Definition: taskswnd.cpp:90
INT IconIndex
Definition: taskswnd.cpp:86
PTASK_GROUP Group
Definition: taskswnd.cpp:84
DWORD IsFlashing
Definition: taskswnd.cpp:95
DWORD RenderFlashed
Definition: taskswnd.cpp:99
HWND hWnd
Definition: taskswnd.cpp:83
BYTE fsState
Definition: commctrl.h:951
INT_PTR iString
Definition: commctrl.h:959
int idCommand
Definition: commctrl.h:950
DWORD_PTR dwData
Definition: commctrl.h:958
int iBitmap
Definition: commctrl.h:949
BYTE fsStyle
Definition: commctrl.h:952
ULONG_PTR dwData
Definition: winuser.h:3012
HWND hwndFrom
Definition: winuser.h:3168
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
struct _TASK_ITEM * PTASK_ITEM
HRESULT CTaskSwitchWnd_CreateInstance(IN HWND hWndParent, IN OUT ITrayWindow *Tray, REFIID riid, void **ppv)
Definition: taskswnd.cpp:2067
#define TASK_ITEM_ARRAY_ALLOC
Definition: taskswnd.cpp:32
struct _TASK_GROUP TASK_GROUP
#define GET_ICON(type)
const WCHAR szTaskSwitchWndClass[]
Definition: taskswnd.cpp:34
#define MAX_TASKS_COUNT
Definition: taskswnd.cpp:31
const WCHAR szRunningApps[]
Definition: taskswnd.cpp:35
struct _TASK_GROUP * PTASK_GROUP
struct _TASK_ITEM TASK_ITEM
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
#define DWORD_PTR
Definition: treelist.c:76
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t DWORD_PTR
Definition: typedefs.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HIWORD(l)
Definition: typedefs.h:247
#define OUT
Definition: typedefs.h:40
struct _BALLOON_HARD_ERROR_DATA * PBALLOON_HARD_ERROR_DATA
#define WM_KLUDGEMINRECT
Definition: undocuser.h:40
#define WM_POPUPSYSTEMMENU
Definition: undocuser.h:61
HRESULT WINAPI SetWindowTheme(_In_ HWND hwnd, _In_ LPCWSTR pszSubAppName, _In_ LPCWSTR pszSubIdList)
Definition: uxthemesupp.c:69
@ TDP_FLASHBUTTON
Definition: vssym32.h:578
int ret
_In_ WDFCOLLECTION _In_ ULONG Index
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
BOOL WINAPI IsHungAppWindow(HWND hwnd)
Definition: window.c:1845
#define ZeroMemory
Definition: winbase.h:1744
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
#define MoveMemory
Definition: winbase.h:1741
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define WM_ERASEBKGND
Definition: winuser.h:1636
DWORD WINAPI GetSysColor(_In_ int)
#define HSHELL_RUDEAPPACTIVATED
Definition: winuser.h:1292
#define SM_CXMINIMIZED
Definition: winuser.h:1031
#define SM_CYEDGE
Definition: winuser.h:1020
#define WM_QUIT
Definition: winuser.h:1634
#define GCLP_HICONSM
Definition: winuser.h:683
#define MAKELPARAM(l, h)
Definition: winuser.h:4019
#define HSHELL_ACTIVATESHELLWINDOW
Definition: winuser.h:1268
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define SM_CXEDGE
Definition: winuser.h:1019
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define HSHELL_WINDOWDESTROYED
Definition: winuser.h:1267
#define IMAGE_ICON
Definition: winuser.h:212
#define GCLP_HICON
Definition: winuser.h:682
#define WM_CREATE
Definition: winuser.h:1619
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define SW_MINIMIZE
Definition: winuser.h:787
#define HSHELL_WINDOWCREATED
Definition: winuser.h:1266
#define WM_SIZE
Definition: winuser.h:1622
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HBRUSH WINAPI GetSysColorBrush(_In_ int)
struct tagCOPYDATASTRUCT * PCOPYDATASTRUCT
#define WM_COMMAND
Definition: winuser.h:1751
#define HTVSCROLL
Definition: winuser.h:2493
BOOL WINAPI SetForegroundWindow(_In_ HWND)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2540
#define HTHSCROLL
Definition: winuser.h:2492
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:3032
#define WM_NCHITTEST
Definition: winuser.h:1697
#define SM_CYSMICON
Definition: winuser.h:1024
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define GetClassLongPtr
Definition: winuser.h:5802
#define MA_NOACTIVATE
Definition: winuser.h:2514
#define CS_DBLCLKS
Definition: winuser.h:659
#define PostThreadMessage
Definition: winuser.h:5853
BOOL WINAPI SendMessageCallbackW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM, _In_ SENDASYNCPROC, _In_ ULONG_PTR)
#define SM_CXSIZE
Definition: winuser.h:1002
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
BOOL WINAPI ShowWindowAsync(_In_ HWND, _In_ int)
#define WM_SETTINGCHANGE
Definition: winuser.h:1640
#define SM_CXSMICON
Definition: winuser.h:1023
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SM_CYICON
Definition: winuser.h:984
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
#define WM_SETFONT
Definition: winuser.h:1661
#define WM_TIMER
Definition: winuser.h:1753
#define WM_COPYDATA
Definition: winuser.h:1675
#define WM_NULL
Definition: winuser.h:1618
#define SendMessage
Definition: winuser.h:5863
UINT WINAPI RegisterWindowMessageW(_In_ LPCWSTR)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938
#define HSHELL_FLASH
Definition: winuser.h:1291
#define WM_MOUSEACTIVATE
Definition: winuser.h:1648
#define LR_SHARED
Definition: winuser.h:1111
#define PostMessage
Definition: winuser.h:5852
#define HTTRANSPARENT
Definition: winuser.h:2484
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1620
#define LR_DEFAULTSIZE
Definition: winuser.h:1105
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1258
INT WINAPI InternalGetWindowText(_In_ HWND hWnd, _Out_writes_to_(cchMaxCount, return+1) LPWSTR pString, _In_ int cchMaxCount)
#define SM_CXICON
Definition: winuser.h:983
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_3DFACE
Definition: winuser.h:940
#define WM_SETREDRAW
Definition: winuser.h:1627
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
static void Initialize()
Definition: xlate.c:212
#define IID_PPV_ARG(Itype, ppType)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185