ReactOS  0.4.13-dev-551-gf37fb1f
traywnd.cpp File Reference
#include "precomp.h"
#include <commoncontrols.h>
#include <traycmd.h>
Include dependency graph for traywnd.cpp:

Go to the source code of this file.

Classes

struct  EFFECTIVE_INFO
 
class  CStartButton
 
class  CTrayWindow
 
struct  CTrayWindow::MINIMIZE_INFO
 
class  CTrayWindowCtxMenu
 

Macros

#define WM_APP_TRAYDESTROY   (WM_APP + 0x100)
 
#define TIMER_ID_AUTOHIDE   1
 
#define TIMER_ID_MOUSETRACK   2
 
#define MOUSETRACK_INTERVAL   100
 
#define AUTOHIDE_DELAY_HIDE   2000
 
#define AUTOHIDE_DELAY_SHOW   50
 
#define AUTOHIDE_INTERVAL_ANIMATING   10
 
#define AUTOHIDE_SPEED_SHOW   10
 
#define AUTOHIDE_SPEED_HIDE   1
 
#define AUTOHIDE_HIDDEN   0
 
#define AUTOHIDE_SHOWING   1
 
#define AUTOHIDE_SHOWN   2
 
#define AUTOHIDE_HIDING   3
 
#define IDHK_RUN   0x1f4
 
#define IDHK_MINIMIZE_ALL   0x1f5
 
#define IDHK_RESTORE_ALL   0x1f6
 
#define IDHK_HELP   0x1f7
 
#define IDHK_EXPLORE   0x1f8
 
#define IDHK_FIND   0x1f9
 
#define IDHK_FIND_COMPUTER   0x1fa
 
#define IDHK_NEXT_TASK   0x1fb
 
#define IDHK_PREV_TASK   0x1fc
 
#define IDHK_SYS_PROPERTIES   0x1fd
 
#define IDHK_DESKTOP   0x1fe
 
#define IDHK_PAGER   0x1ff
 

Functions

HRESULT TrayWindowCtxMenuCreator (ITrayWindow *TrayWnd, IN HWND hWndOwner, IContextMenu **ppCtxMenu)
 
static BOOL CALLBACK FindEffectiveProc (HWND hwnd, LPARAM lParam)
 
static BOOL IsThereAnyEffectiveWindow (BOOL bMustBeInMonitor)
 
HRESULT CreateTrayWindow (ITrayWindow **ppTray)
 
HRESULT Tray_OnStartMenuDismissed (ITrayWindow *Tray)
 
VOID TrayProcessMessages (ITrayWindow *Tray)
 
VOID TrayMessageLoop (ITrayWindow *Tray)
 

Variables

static const WCHAR szTrayWndClass [] = L"Shell_TrayWnd"
 
CSimpleArray< HWNDg_MinimizedAll
 
const GUID IID_IShellDesktopTray = { 0x213e2df9, 0x9a14, 0x4328, { 0x99, 0xb1, 0x69, 0x61, 0xf9, 0x14, 0x3c, 0xe9 } }
 

Macro Definition Documentation

◆ AUTOHIDE_DELAY_HIDE

#define AUTOHIDE_DELAY_HIDE   2000

Definition at line 33 of file traywnd.cpp.

◆ AUTOHIDE_DELAY_SHOW

#define AUTOHIDE_DELAY_SHOW   50

Definition at line 34 of file traywnd.cpp.

◆ AUTOHIDE_HIDDEN

#define AUTOHIDE_HIDDEN   0

Definition at line 40 of file traywnd.cpp.

◆ AUTOHIDE_HIDING

#define AUTOHIDE_HIDING   3

Definition at line 43 of file traywnd.cpp.

◆ AUTOHIDE_INTERVAL_ANIMATING

#define AUTOHIDE_INTERVAL_ANIMATING   10

Definition at line 35 of file traywnd.cpp.

◆ AUTOHIDE_SHOWING

#define AUTOHIDE_SHOWING   1

Definition at line 41 of file traywnd.cpp.

◆ AUTOHIDE_SHOWN

#define AUTOHIDE_SHOWN   2

Definition at line 42 of file traywnd.cpp.

◆ AUTOHIDE_SPEED_HIDE

#define AUTOHIDE_SPEED_HIDE   1

Definition at line 38 of file traywnd.cpp.

◆ AUTOHIDE_SPEED_SHOW

#define AUTOHIDE_SPEED_SHOW   10

Definition at line 37 of file traywnd.cpp.

◆ IDHK_DESKTOP

#define IDHK_DESKTOP   0x1fe

Definition at line 55 of file traywnd.cpp.

◆ IDHK_EXPLORE

#define IDHK_EXPLORE   0x1f8

Definition at line 49 of file traywnd.cpp.

◆ IDHK_FIND

#define IDHK_FIND   0x1f9

Definition at line 50 of file traywnd.cpp.

◆ IDHK_FIND_COMPUTER

#define IDHK_FIND_COMPUTER   0x1fa

Definition at line 51 of file traywnd.cpp.

◆ IDHK_HELP

#define IDHK_HELP   0x1f7

Definition at line 48 of file traywnd.cpp.

◆ IDHK_MINIMIZE_ALL

#define IDHK_MINIMIZE_ALL   0x1f5

Definition at line 46 of file traywnd.cpp.

◆ IDHK_NEXT_TASK

#define IDHK_NEXT_TASK   0x1fb

Definition at line 52 of file traywnd.cpp.

◆ IDHK_PAGER

#define IDHK_PAGER   0x1ff

Definition at line 56 of file traywnd.cpp.

◆ IDHK_PREV_TASK

#define IDHK_PREV_TASK   0x1fc

Definition at line 53 of file traywnd.cpp.

◆ IDHK_RESTORE_ALL

#define IDHK_RESTORE_ALL   0x1f6

Definition at line 47 of file traywnd.cpp.

◆ IDHK_RUN

#define IDHK_RUN   0x1f4

Definition at line 45 of file traywnd.cpp.

◆ IDHK_SYS_PROPERTIES

#define IDHK_SYS_PROPERTIES   0x1fd

Definition at line 54 of file traywnd.cpp.

◆ MOUSETRACK_INTERVAL

#define MOUSETRACK_INTERVAL   100

Definition at line 32 of file traywnd.cpp.

◆ TIMER_ID_AUTOHIDE

#define TIMER_ID_AUTOHIDE   1

Definition at line 30 of file traywnd.cpp.

◆ TIMER_ID_MOUSETRACK

#define TIMER_ID_MOUSETRACK   2

Definition at line 31 of file traywnd.cpp.

◆ WM_APP_TRAYDESTROY

#define WM_APP_TRAYDESTROY   (WM_APP + 0x100)

Definition at line 28 of file traywnd.cpp.

Function Documentation

◆ CreateTrayWindow()

HRESULT CreateTrayWindow ( ITrayWindow **  ppTray)

Definition at line 3390 of file traywnd.cpp.

3391 {
3393  if (Tray == NULL)
3394  return E_OUTOFMEMORY;
3395 
3396  Tray->_Init();
3397  Tray->Open();
3398 
3399  *ppTray = (ITrayWindow *) Tray;
3400 
3401  return S_OK;
3402 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

Referenced by StartWithDesktop().

◆ FindEffectiveProc()

static BOOL CALLBACK FindEffectiveProc ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 70 of file traywnd.cpp.

71 {
73 
75  return TRUE; // continue
76 
77  if (pei->hTrayWnd == hwnd || pei->hwndDesktop == hwnd ||
78  pei->hwndProgman == hwnd)
79  {
80  return TRUE; // continue
81  }
82 
83  if (pei->bMustBeInMonitor)
84  {
85  // is the window in the nearest monitor?
86  HMONITOR hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
87  if (hMon)
88  {
90  ZeroMemory(&info, sizeof(info));
91  info.cbSize = sizeof(info);
92  if (GetMonitorInfoW(hMon, &info))
93  {
94  RECT rcWindow, rcMonitor, rcIntersect;
95  rcMonitor = info.rcMonitor;
96 
97  GetWindowRect(hwnd, &rcWindow);
98 
99  if (!IntersectRect(&rcIntersect, &rcMonitor, &rcWindow))
100  return TRUE; // continue
101  }
102  }
103  }
104 
105  pei->hwndFound = hwnd;
106  return FALSE; // stop if found
107 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI IsIconic(_In_ HWND)
struct _test_info info[]
Definition: SetCursorPos.c:19
HWND hwndFound
Definition: traywnd.cpp:62
HWND hwndProgman
Definition: traywnd.cpp:64
HWND hwndDesktop
Definition: traywnd.cpp:63
BOOL bMustBeInMonitor
Definition: traywnd.cpp:66
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
LPARAM lParam
Definition: combotst.c:139

Referenced by IsThereAnyEffectiveWindow().

◆ IsThereAnyEffectiveWindow()

static BOOL IsThereAnyEffectiveWindow ( BOOL  bMustBeInMonitor)
static

Definition at line 110 of file traywnd.cpp.

111 {
112  EFFECTIVE_INFO ei;
113  ei.hwndFound = NULL;
115  ei.hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
116  ei.hwndProgman = FindWindowW(L"Progman", NULL);
117  ei.bMustBeInMonitor = bMustBeInMonitor;
118 
120  if (ei.hwndFound && FALSE)
121  {
122  WCHAR szClass[64], szText[64];
123  GetClassNameW(ei.hwndFound, szClass, _countof(szClass));
125  MessageBoxW(NULL, szText, szClass, 0);
126  }
127  return ei.hwndFound != NULL;
128 }
#define _countof(array)
Definition: fontsub.cpp:30
static BOOL CALLBACK FindEffectiveProc(HWND hwnd, LPARAM lParam)
Definition: traywnd.cpp:70
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
HWND hwndFound
Definition: traywnd.cpp:62
HWND hwndProgman
Definition: traywnd.cpp:64
static const WCHAR szText[]
Definition: dialog.c:139
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
HWND hwndDesktop
Definition: traywnd.cpp:63
LONG_PTR LPARAM
Definition: windef.h:208
BOOL bMustBeInMonitor
Definition: traywnd.cpp:66
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
HWND WINAPI FindWindowW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378

Referenced by CTrayWindow::OnInitMenuPopup(), CTrayWindowCtxMenu::QueryContextMenu(), and CTrayWindow::ToggleDesktop().

◆ Tray_OnStartMenuDismissed()

HRESULT Tray_OnStartMenuDismissed ( ITrayWindow *  Tray)

Definition at line 3405 of file traywnd.cpp.

3406 {
3407  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3408  return TrayWindow->RaiseStartButton();
3409 }
virtual HRESULT RaiseStartButton()
Definition: traywnd.cpp:3215

Referenced by CStartMenuSite::SetSubMenu().

◆ TrayMessageLoop()

VOID TrayMessageLoop ( ITrayWindow *  Tray)

Definition at line 3417 of file traywnd.cpp.

3418 {
3419  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3420  TrayWindow->TrayMessageLoop();
3421 }
VOID TrayMessageLoop()
Definition: traywnd.cpp:3154

◆ TrayProcessMessages()

VOID TrayProcessMessages ( ITrayWindow *  Tray)

Definition at line 3411 of file traywnd.cpp.

3412 {
3413  CTrayWindow * TrayWindow = static_cast<CTrayWindow *>(Tray);
3414  TrayWindow->TrayProcessMessages();
3415 }

◆ TrayWindowCtxMenuCreator()

HRESULT TrayWindowCtxMenuCreator ( ITrayWindow *  TrayWnd,
IN HWND  hWndOwner,
IContextMenu **  ppCtxMenu 
)

Definition at line 3382 of file traywnd.cpp.

3383 {
3385  mnu->Initialize(TrayWnd, hWndOwner);
3386  *ppCtxMenu = mnu;
3387  return S_OK;
3388 }
#define S_OK
Definition: intsafe.h:59
HRESULT Initialize(ITrayWindow *pTrayWnd, IN HWND hWndOwner)
Definition: traywnd.cpp:3261

Referenced by CTrayWindow::QueryContextMenu().

Variable Documentation

◆ g_MinimizedAll

◆ IID_IShellDesktopTray

const GUID IID_IShellDesktopTray = { 0x213e2df9, 0x9a14, 0x4328, { 0x99, 0xb1, 0x69, 0x61, 0xf9, 0x14, 0x3c, 0xe9 } }

Definition at line 136 of file traywnd.cpp.

◆ szTrayWndClass

const WCHAR szTrayWndClass[] = L"Shell_TrayWnd"
static

Definition at line 58 of file traywnd.cpp.