ReactOS  0.4.15-dev-1150-g593bcce
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 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define SWP_DRAWFRAME
Definition: winuser.h:1224
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
GLint dy
Definition: linetemp.h:97
BOOL WINAPI UpdateWindow(_In_ HWND)
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
LONG top
Definition: windef.h:307
GLdouble GLdouble t
Definition: gl.h:2047
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
HANDLE WINAPI GetCurrentThread(VOID)
Definition: proc.c:1148
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define THREAD_PRIORITY_HIGHEST
Definition: winbase.h:274
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:699
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define SWP_NOSIZE
Definition: winuser.h:1230
#define SLIDE_HIDE
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint dx
Definition: linetemp.h:97
HANDLE hThread
Definition: wizard.c:27
LONG bottom
Definition: windef.h:309
static int priority
Definition: timer.c:163
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 SLIDE_SHOW
_Out_ LPRECT prc
Definition: ntgdi.h:1658
int WINAPI GetThreadPriority(IN HANDLE hThread)
Definition: thread.c:738

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 
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 }
#define WS_THICKFRAME
Definition: pedump.c:630
#define ID_ACTION
#define SystemParametersInfo
Definition: winuser.h:5833
#define WS_CLIPCHILDREN
Definition: pedump.c:619
static INT DoMainLoop()
HINSTANCE hInstance
Definition: charmap.c:20
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define PostMessage
Definition: winuser.h:5807
#define WM_COMMAND
Definition: winuser.h:1722
static HWND s_hwnd2
static BOOL DoRegisterClass(HINSTANCE hInstance)
static HWND s_hwnd1
static RECT s_rcWorkArea
#define TEXT(s)
Definition: k32.h:26
#define WS_BORDER
Definition: pedump.c:625
#define GetModuleHandle
Definition: winbase.h:3667
#define WS_POPUP
Definition: pedump.c:616
#define skip(...)
Definition: atltest.h:64
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)

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().