ReactOS 0.4.17-dev-966-gf06eace
taskswnd.cpp File Reference
#include "precomp.h"
#include "mediabtns.h"
#include <commoncontrols.h>
#include <regstr.h>
#include <shlwapi_undoc.h>
#include <psapi.h>
Include dependency graph for taskswnd.cpp:

Go to the source code of this file.

Classes

struct  _TASK_GROUP
 
struct  _TASK_ITEM
 
class  CHardErrorThread
 
class  CTaskToolbar
 
class  CTaskSwitchWnd
 
struct  CTaskSwitchWnd::tagRUDEAPPDATA
 
struct  CTaskSwitchWnd::tagFULLSCREENDATA
 

Macros

#define DUMP_TASKS   0
 
#define DEBUG_SHELL_HOOK   0
 
#define MAX_TASKS_COUNT   (0x7FFF)
 
#define TASK_ITEM_ARRAY_ALLOC   64
 
#define TIMER_ID_VALIDATE_RUDE_APP   5
 
#define VALIDATE_RUDE_INTERVAL   1000
 
#define VALIDATE_RUDE_MAX_COUNT   5
 
#define GET_ICON(type)    SendMessageTimeout(hwnd, WM_GETICON, (type), 0, SMTO_NOTIMEOUTIFNOTHUNG, 100, (PDWORD_PTR)&hIcon)
 

Typedefs

typedef struct _TASK_GROUP TASK_GROUP
 
typedef struct _TASK_GROUP * PTASK_GROUP
 
typedef struct _TASK_ITEM TASK_ITEM
 
typedef struct _TASK_ITEM * PTASK_ITEM
 

Functions

static BOOL SHELL_GetMonitorRect (_In_opt_ HMONITOR hMonitor, _Out_opt_ PRECT prcDest, _In_ BOOL bWorkAreaOnly)
 
static BOOL SHELL_IsParentOwnerOrSelf (_In_ HWND hwndTarget, _In_ HWND hWnd)
 
static BOOL SHELL_IsRudeWindowActive (_In_ HWND hWnd)
 
static BOOL SHELL_IsRudeWindow (_In_opt_ HMONITOR hMonitor, _In_ HWND hWnd, _In_ BOOL bDontCheckActive)
 
static BOOL SHELL_GetImageFileNameByWindow (_In_ HWND hWnd, _Out_cap_(cchPath) LPWSTR pszPath, _In_ DWORD cchPath)
 
HRESULT CTaskSwitchWnd_CreateInstance (IN HWND hWndParent, IN OUT ITrayWindow *Tray, REFIID riid, void **ppv)
 

Variables

const WCHAR szTaskSwitchWndClass [] = L"MSTaskSwWClass"
 
const WCHAR szRunningApps [] = L"Running Applications"
 

Macro Definition Documentation

◆ DEBUG_SHELL_HOOK

#define DEBUG_SHELL_HOOK   0

Definition at line 19 of file taskswnd.cpp.

◆ DUMP_TASKS

#define DUMP_TASKS   0

Definition at line 18 of file taskswnd.cpp.

◆ GET_ICON

#define GET_ICON (   type)     SendMessageTimeout(hwnd, WM_GETICON, (type), 0, SMTO_NOTIMEOUTIFNOTHUNG, 100, (PDWORD_PTR)&hIcon)

◆ MAX_TASKS_COUNT

#define MAX_TASKS_COUNT   (0x7FFF)

Definition at line 21 of file taskswnd.cpp.

◆ TASK_ITEM_ARRAY_ALLOC

#define TASK_ITEM_ARRAY_ALLOC   64

Definition at line 22 of file taskswnd.cpp.

◆ TIMER_ID_VALIDATE_RUDE_APP

#define TIMER_ID_VALIDATE_RUDE_APP   5

Definition at line 27 of file taskswnd.cpp.

◆ VALIDATE_RUDE_INTERVAL

#define VALIDATE_RUDE_INTERVAL   1000

Definition at line 28 of file taskswnd.cpp.

◆ VALIDATE_RUDE_MAX_COUNT

#define VALIDATE_RUDE_MAX_COUNT   5

Definition at line 29 of file taskswnd.cpp.

Typedef Documentation

◆ PTASK_GROUP

◆ PTASK_ITEM

◆ TASK_GROUP

◆ TASK_ITEM

Function Documentation

◆ CTaskSwitchWnd_CreateInstance()

HRESULT CTaskSwitchWnd_CreateInstance ( IN HWND  hWndParent,
IN OUT ITrayWindow *  Tray,
REFIID  riid,
void **  ppv 
)

Definition at line 2386 of file taskswnd.cpp.

2387{
2388 return ShellObjectCreatorInit<CTaskSwitchWnd>(hWndParent, Tray, riid, ppv);
2389}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by CTaskBand::SetSite().

◆ SHELL_GetImageFileNameByWindow()

static BOOL SHELL_GetImageFileNameByWindow ( _In_ HWND  hWnd,
_Out_cap_(cchPath) LPWSTR  pszPath,
_In_ DWORD  cchPath 
)
static

Definition at line 106 of file taskswnd.cpp.

107{
110 BOOL bSuccess;
112 return FALSE;
113 // TODO: Switch to PROCESS_QUERY_LIMITED_INFORMATION once NT6 kernel32 support is implemented.
115 if (hProcess == NULL)
116 return FALSE;
117 bSuccess = GetModuleFileNameExW(hProcess, NULL, pszPath, cchPath) != 0;
119 return bSuccess;
120}
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetModuleFileNameExW(w, x, y, z)
Definition: compat.h:922
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1274
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define PROCESS_VM_READ
Definition: pstypes.h:157
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:162
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
_In_ DWORD dwProcessId
Definition: shlwapi.h:193
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)

Referenced by CTaskSwitchWnd::OnActivateTaskIndex().

◆ SHELL_GetMonitorRect()

static BOOL SHELL_GetMonitorRect ( _In_opt_ HMONITOR  hMonitor,
_Out_opt_ PRECT  prcDest,
_In_ BOOL  bWorkAreaOnly 
)
static

Definition at line 32 of file taskswnd.cpp.

36{
37 MONITORINFO mi = { sizeof(mi) };
38 if (!hMonitor || !::GetMonitorInfoW(hMonitor, &mi))
39 {
40 if (!prcDest)
41 return FALSE;
42
43 if (bWorkAreaOnly)
44 ::SystemParametersInfoW(SPI_GETWORKAREA, 0, prcDest, 0);
45 else
46 ::SetRect(prcDest, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
47
48 return FALSE;
49 }
50
51 if (prcDest)
52 *prcDest = (bWorkAreaOnly ? mi.rcWork : mi.rcMonitor);
53 return TRUE;
54}
#define TRUE
Definition: types.h:120
static MONITORINFO mi
Definition: win.c:9400
#define SM_CYSCREEN
Definition: winuser.h:971
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define SM_CXSCREEN
Definition: winuser.h:970
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
int WINAPI GetSystemMetrics(_In_ int)
RECT rcMonitor
Definition: winuser.h:3893

Referenced by CTaskSwitchWnd::FullScreenEnumProc(), and SHELL_IsRudeWindow().

◆ SHELL_IsParentOwnerOrSelf()

static BOOL SHELL_IsParentOwnerOrSelf ( _In_ HWND  hwndTarget,
_In_ HWND  hWnd 
)
static

Definition at line 57 of file taskswnd.cpp.

58{
59 for (; hWnd; hWnd = ::GetParent(hWnd))
60 {
61 if (hWnd == hwndTarget)
62 return TRUE;
63 }
64 return FALSE;
65}
HWND WINAPI GetParent(_In_ HWND)

Referenced by SHELL_IsRudeWindowActive().

◆ SHELL_IsRudeWindow()

static BOOL SHELL_IsRudeWindow ( _In_opt_ HMONITOR  hMonitor,
_In_ HWND  hWnd,
_In_ BOOL  bDontCheckActive 
)
static

Definition at line 77 of file taskswnd.cpp.

78{
80 return FALSE;
81
82 RECT rcMonitor;
83 SHELL_GetMonitorRect(hMonitor, &rcMonitor, FALSE);
84
86
87 RECT rcWnd;
88 enum { CHECK_STYLE = WS_THICKFRAME | WS_DLGFRAME | WS_BORDER };
89 if ((style & CHECK_STYLE) == CHECK_STYLE)
90 {
91 ::GetClientRect(hWnd, &rcWnd); // Ignore frame
92 ::MapWindowPoints(hWnd, NULL, (PPOINT)&rcWnd, sizeof(RECT) / sizeof(POINT));
93 }
94 else
95 {
96 ::GetWindowRect(hWnd, &rcWnd);
97 }
98
99 RECT rcUnion;
100 ::UnionRect(&rcUnion, &rcWnd, &rcMonitor);
101
102 return ::EqualRect(&rcUnion, &rcWnd) && (bDontCheckActive || SHELL_IsRudeWindowActive(hWnd));
103}
#define WS_BORDER
Definition: pedump.c:625
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_THICKFRAME
Definition: pedump.c:630
#define GetWindowLongPtrW
Definition: winuser.h:4983
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI IsWindowVisible(_In_ HWND)
Definition: dcommon.idl:28
Definition: style.c:91
static BOOL SHELL_IsRudeWindowActive(_In_ HWND hWnd)
Definition: taskswnd.cpp:68
static BOOL SHELL_GetMonitorRect(_In_opt_ HMONITOR hMonitor, _Out_opt_ PRECT prcDest, _In_ BOOL bWorkAreaOnly)
Definition: taskswnd.cpp:32

Referenced by CTaskSwitchWnd::IsRudeEnumProc().

◆ SHELL_IsRudeWindowActive()

static BOOL SHELL_IsRudeWindowActive ( _In_ HWND  hWnd)
static

Definition at line 68 of file taskswnd.cpp.

69{
70 HWND hwndFore = ::GetForegroundWindow();
72 return dwThreadId == ::GetWindowThreadProcessId(hwndFore, NULL) ||
74}
DWORD dwThreadId
Definition: fdebug.c:31
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
static BOOL SHELL_IsParentOwnerOrSelf(_In_ HWND hwndTarget, _In_ HWND hWnd)
Definition: taskswnd.cpp:57

Referenced by CTaskSwitchWnd::HandleFullScreenApp(), and SHELL_IsRudeWindow().

Variable Documentation

◆ szRunningApps

const WCHAR szRunningApps[] = L"Running Applications"

Definition at line 125 of file taskswnd.cpp.

Referenced by CTaskSwitchWnd::Initialize().

◆ szTaskSwitchWndClass

const WCHAR szTaskSwitchWndClass[] = L"MSTaskSwWClass"

Definition at line 124 of file taskswnd.cpp.