ReactOS 0.4.17-dev-357-ga8f14ff
SHAppBarMessage.cpp File Reference
#include "shelltest.h"
#include <windowsx.h>
#include <shlwapi.h>
#include <stdio.h>
Include dependency graph for SHAppBarMessage.cpp:

Go to the source code of this file.

Classes

class  Window
 

Macros

#define IDT_AUTOHIDE   1
 
#define IDT_AUTOUNHIDE   2
 
#define ID_ACTION   100
 
#define ID_QUIT   999
 
#define APPBAR_CALLBACK   (WM_USER + 100)
 
#define LEFT_DOWN()   mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
 
#define LEFT_UP()   mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
 
#define MOVE(x, y)   SetCursorPos((x), (y))
 
#define INTERVAL   250
 
#define LONG_INTERVAL   2500
 
#define SLIDE_HIDE   400
 
#define SLIDE_SHOW   150
 

Functions

void SlideWindow (HWND hwnd, LPRECT prc)
 
 START_TEST (SHAppBarMessage)
 

Variables

static const TCHAR s_szName [] = TEXT("AppBarSample")
 
static RECT s_rcPrimaryMonitor
 
static RECT s_rcWorkArea
 
static RECT s_rcTaskBar
 
static HWND s_hwnd1 = NULL
 
static HWND s_hwnd2 = NULL
 

Macro Definition Documentation

◆ APPBAR_CALLBACK

#define APPBAR_CALLBACK   (WM_USER + 100)

Definition at line 23 of file SHAppBarMessage.cpp.

◆ ID_ACTION

#define ID_ACTION   100

Definition at line 20 of file SHAppBarMessage.cpp.

◆ ID_QUIT

#define ID_QUIT   999

Definition at line 21 of file SHAppBarMessage.cpp.

◆ IDT_AUTOHIDE

#define IDT_AUTOHIDE   1

Definition at line 17 of file SHAppBarMessage.cpp.

◆ IDT_AUTOUNHIDE

#define IDT_AUTOUNHIDE   2

Definition at line 18 of file SHAppBarMessage.cpp.

◆ INTERVAL

#define INTERVAL   250

Definition at line 29 of file SHAppBarMessage.cpp.

◆ LEFT_DOWN

#define LEFT_DOWN ( )    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);

Definition at line 25 of file SHAppBarMessage.cpp.

◆ LEFT_UP

#define LEFT_UP ( )    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);

Definition at line 26 of file SHAppBarMessage.cpp.

◆ LONG_INTERVAL

#define LONG_INTERVAL   2500

Definition at line 30 of file SHAppBarMessage.cpp.

◆ MOVE

#define MOVE (   x,
  y 
)    SetCursorPos((x), (y))

Definition at line 27 of file SHAppBarMessage.cpp.

◆ SLIDE_HIDE

#define SLIDE_HIDE   400

◆ SLIDE_SHOW

#define SLIDE_SHOW   150

Function Documentation

◆ SlideWindow()

void SlideWindow ( HWND  hwnd,
LPRECT  prc 
)

Definition at line 82 of file SHAppBarMessage.cpp.

83{
84#define SLIDE_HIDE 400
85#define SLIDE_SHOW 150
86 RECT rcOld, rcNew = *prc;
87 GetWindowRect(hwnd, &rcOld);
88
89 BOOL fShow = (rcNew.bottom - rcNew.top > rcOld.bottom - rcOld.top) ||
90 (rcNew.right - rcNew.left > rcOld.right - rcOld.left);
91
92 INT dx = (rcNew.right - rcOld.right) + (rcNew.left - rcOld.left);
93 INT dy = (rcNew.bottom - rcOld.bottom) + (rcNew.top - rcOld.top);
94
95 LONG dt = SLIDE_HIDE;
96 if (fShow)
97 {
98 dt = SLIDE_SHOW;
99 rcOld = rcNew;
100 OffsetRect(&rcOld, -dx, -dy);
101 SetWindowPos(hwnd, NULL, rcOld.left, rcOld.top,
102 rcOld.right - rcOld.left, rcOld.bottom - rcOld.top,
104 }
105
109
110 LONG t, t0 = GetTickCount();
111 while ((t = GetTickCount()) < t0 + dt)
112 {
113 INT x = rcOld.left + dx * (t - t0) / dt;
114 INT y = rcOld.top + dy * (t - t0) / dt;
116
119 }
120
122 SetWindowPos(hwnd, NULL, rcNew.left, rcNew.top,
123 rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
125#undef SLIDE_HIDE
126#undef SLIDE_SHOW
127}
#define SLIDE_HIDE
#define SLIDE_SHOW
#define NULL
Definition: types.h:112
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:700
int WINAPI GetThreadPriority(IN HANDLE hThread)
Definition: thread.c:739
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble t
Definition: gl.h:2047
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
static int priority
Definition: timer.c:163
HANDLE hThread
Definition: wizard.c:28
long LONG
Definition: pedump.c:60
_Out_ LPRECT prc
Definition: ntgdi.h:1658
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
int32_t INT
Definition: typedefs.h:58
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1145
#define THREAD_PRIORITY_HIGHEST
Definition: winbase.h:302
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_DRAWFRAME
Definition: winuser.h:1250
#define SWP_NOSIZE
Definition: winuser.h:1256
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SWP_NOZORDER
Definition: winuser.h:1258

Referenced by Window::AppBar_AutoHide(), Window::AppBar_Hide(), and Window::AppBar_UnHide().

◆ START_TEST()

START_TEST ( SHAppBarMessage  )

Definition at line 1212 of file SHAppBarMessage.cpp.

1213{
1215
1216 // Check Taskbar
1217 HWND hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL);
1218 if (!IsWindowVisible(hTrayWnd))
1219 {
1220 skip("Taskbar not found\n");
1221 return;
1222 }
1223
1224 // Taskbar
1225 RECT rc;
1226 GetWindowRect(hTrayWnd, &rc);
1227 s_rcTaskBar = rc;
1228 trace("s_rcTaskBar: %ld, %ld, %ld, %ld\n", rc.left, rc.top, rc.right, rc.bottom);
1229
1230 // Work area
1231 SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE);
1232 s_rcWorkArea = rc;
1233 trace("s_rcWorkArea: %ld, %ld, %ld, %ld\n", rc.left, rc.top, rc.right, rc.bottom);
1234
1235 // Primary monitor
1237 s_rcPrimaryMonitor = rc;
1238 trace("s_rcPrimaryMonitor: %ld, %ld, %ld, %ld\n", rc.left, rc.top, rc.right, rc.bottom);
1239
1243 {
1244 // Taskbar must be bottom in this testcase
1245 skip("Taskbar was not bottom\n");
1246 return;
1247 }
1248
1249 if (!Window::DoRegisterClass(hInstance))
1250 {
1251 skip("Window::DoRegisterClass failed\n");
1252 return;
1253 }
1254
1255 trace("SM_CMONITORS: %d\n", GetSystemMetrics(SM_CMONITORS));
1257 {
1258 skip("Multi-monitor not supported yet\n");
1259 return;
1260 }
1261
1262 HWND hwnd1 = Window::DoCreateMainWnd(hInstance, TEXT("Test1"), 80, 80,
1264 if (!hwnd1)
1265 {
1266 skip("CreateWindowExW failed\n");
1267 return;
1268 }
1269
1270 HWND hwnd2 = Window::DoCreateMainWnd(hInstance, TEXT("Test2"), 30, 30,
1272 if (!hwnd2)
1273 {
1274 skip("CreateWindowExW failed\n");
1275 return;
1276 }
1277
1278 s_hwnd1 = hwnd1;
1279 s_hwnd2 = hwnd2;
1280
1281 PostMessageW(hwnd1, WM_COMMAND, ID_ACTION, 0);
1282
1283 // message loop
1284 MSG msg;
1285 while (GetMessage(&msg, NULL, 0, 0))
1286 {
1289 }
1290}
static RECT s_rcWorkArea
#define ID_ACTION
static RECT s_rcPrimaryMonitor
static RECT s_rcTaskBar
static HWND s_hwnd2
static HWND s_hwnd1
#define trace
Definition: atltest.h:70
#define skip(...)
Definition: atltest.h:64
#define msg(x)
Definition: auth_time.c:54
HINSTANCE hInstance
Definition: charmap.c:19
#define FALSE
Definition: types.h:117
#define L(x)
Definition: resources.c:13
#define TEXT(s)
Definition: k32.h:28
#define WS_BORDER
Definition: pedump.c:625
#define WS_POPUP
Definition: pedump.c:616
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define WS_THICKFRAME
Definition: pedump.c:630
static HWND DoCreateMainWnd(HINSTANCE hInstance, LPCTSTR pszText, INT cx, INT cy, DWORD style=WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN, DWORD exstyle=WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_TOPMOST, BOOL fAutoHide=FALSE)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define GetModuleHandle
Definition: winbase.h:3548
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define SM_CYSCREEN
Definition: winuser.h:971
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1768
#define GetMessage
Definition: winuser.h:5956
#define SM_CXSCREEN
Definition: winuser.h:970
#define DispatchMessage
Definition: winuser.h:5931
HWND WINAPI FindWindowW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
#define SystemParametersInfo
Definition: winuser.h:6024
#define SM_CMONITORS
Definition: winuser.h:1051
BOOL WINAPI IsWindowVisible(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Variable Documentation

◆ s_hwnd1

HWND s_hwnd1 = NULL
static

Definition at line 36 of file SHAppBarMessage.cpp.

Referenced by Window::OnCommand(), Window::Quit(), START_TEST(), and Window::TEST_Main().

◆ s_hwnd2

◆ s_rcPrimaryMonitor

RECT s_rcPrimaryMonitor
static

Definition at line 33 of file SHAppBarMessage.cpp.

Referenced by START_TEST(), and Window::TEST_FullScreen().

◆ s_rcTaskBar

RECT s_rcTaskBar
static

Definition at line 35 of file SHAppBarMessage.cpp.

Referenced by START_TEST(), and Window::TEST_Main().

◆ s_rcWorkArea

RECT s_rcWorkArea
static

◆ s_szName

const TCHAR s_szName[] = TEXT("AppBarSample")
static

Definition at line 32 of file SHAppBarMessage.cpp.

Referenced by Window::DoCreateMainWnd(), and Window::DoRegisterClass().