ReactOS 0.4.15-dev-7931-gfd331f1
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 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 SLIDE_HIDE   400
 
#define SLIDE_SHOW   150
 
#define INTERVAL   250
 

Functions

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

Variables

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

Macro Definition Documentation

◆ APPBAR_CALLBACK

#define APPBAR_CALLBACK   (WM_USER + 100)

Definition at line 22 of file SHAppBarMessage.cpp.

◆ ID_ACTION

#define ID_ACTION   100

Definition at line 20 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

◆ LEFT_DOWN

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

Definition at line 24 of file SHAppBarMessage.cpp.

◆ LEFT_UP

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

Definition at line 25 of file SHAppBarMessage.cpp.

◆ MOVE

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

Definition at line 26 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 90 of file SHAppBarMessage.cpp.

91{
92#define SLIDE_HIDE 400
93#define SLIDE_SHOW 150
94 RECT rcOld, rcNew = *prc;
95 GetWindowRect(hwnd, &rcOld);
96
97 BOOL fShow = (rcNew.bottom - rcNew.top > rcOld.bottom - rcOld.top) ||
98 (rcNew.right - rcNew.left > rcOld.right - rcOld.left);
99
100 INT dx = (rcNew.right - rcOld.right) + (rcNew.left - rcOld.left);
101 INT dy = (rcNew.bottom - rcOld.bottom) + (rcNew.top - rcOld.top);
102
103 LONG dt = SLIDE_HIDE;
104 if (fShow)
105 {
106 dt = SLIDE_SHOW;
107 rcOld = rcNew;
108 OffsetRect(&rcOld, -dx, -dy);
109 SetWindowPos(hwnd, NULL, rcOld.left, rcOld.top,
110 rcOld.right - rcOld.left, rcOld.bottom - rcOld.top,
112 }
113
117
118 LONG t, t0 = GetTickCount();
119 while ((t = GetTickCount()) < t0 + dt)
120 {
121 INT x = rcOld.left + dx * (t - t0) / dt;
122 INT y = rcOld.top + dy * (t - t0) / dt;
124
127 }
128
130 SetWindowPos(hwnd, NULL, rcNew.left, rcNew.top,
131 rcNew.right - rcNew.left, rcNew.bottom - rcNew.top,
133#undef SLIDE_HIDE
134#undef SLIDE_SHOW
135}
#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
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
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
_Out_ LPRECT prc
Definition: ntgdi.h:1658
long LONG
Definition: pedump.c:60
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1148
#define THREAD_PRIORITY_HIGHEST
Definition: winbase.h:277
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SWP_NOACTIVATE
Definition: winuser.h:1242
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:1239
#define SWP_NOSIZE
Definition: winuser.h:1245
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SWP_NOZORDER
Definition: winuser.h:1247

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

◆ START_TEST()

START_TEST ( SHAppBarMessage  )

Definition at line 1117 of file SHAppBarMessage.cpp.

1118{
1120
1121 if (!Window::DoRegisterClass(hInstance))
1122 {
1123 skip("Window::DoRegisterClass failed\n");
1124 return;
1125 }
1126
1127 SystemParametersInfo(SPI_GETWORKAREA, 0, &s_rcWorkArea, FALSE);
1128
1129 HWND hwnd1 = Window::DoCreateMainWnd(hInstance, TEXT("Test1"), 80, 80,
1131 if (!hwnd1)
1132 {
1133 skip("CreateWindowExW failed\n");
1134 return;
1135 }
1136
1137 HWND hwnd2 = Window::DoCreateMainWnd(hInstance, TEXT("Test2"), 30, 30,
1139 if (!hwnd2)
1140 {
1141 skip("CreateWindowExW failed\n");
1142 return;
1143 }
1144
1145 s_hwnd1 = hwnd1;
1146 s_hwnd2 = hwnd2;
1147
1148 PostMessage(hwnd1, WM_COMMAND, ID_ACTION, 0);
1149
1151}
static RECT s_rcWorkArea
#define ID_ACTION
static HWND s_hwnd2
static HWND s_hwnd1
#define skip(...)
Definition: atltest.h:64
HINSTANCE hInstance
Definition: charmap.c:19
#define FALSE
Definition: types.h:117
#define TEXT(s)
Definition: k32.h:26
#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 INT DoMainLoop()
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)
#define GetModuleHandle
Definition: winbase.h:3827
#define WM_COMMAND
Definition: winuser.h:1740
#define PostMessage
Definition: winuser.h:5832
#define SystemParametersInfo
Definition: winuser.h:5858

Variable Documentation

◆ s_hwnd1

HWND s_hwnd1 = NULL
static

Definition at line 30 of file SHAppBarMessage.cpp.

Referenced by Window::DoAction(), Window::OnCommand(), and START_TEST().

◆ s_hwnd2

HWND s_hwnd2 = NULL
static

Definition at line 31 of file SHAppBarMessage.cpp.

Referenced by Window::DoAction(), Window::OnCommand(), and START_TEST().

◆ s_rcWorkArea

RECT s_rcWorkArea
static

Definition at line 29 of file SHAppBarMessage.cpp.

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

◆ s_szName

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

Definition at line 28 of file SHAppBarMessage.cpp.

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