ReactOS  0.4.15-dev-1384-g878186b
DM_REPOSITION.c File Reference
#include "precomp.h"
#include <windowsx.h>
Include dependency graph for DM_REPOSITION.c:

Go to the source code of this file.

Functions

static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
 
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
static INT_PTR CALLBACK DialogProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 START_TEST (DM_REPOSITION)
 

Function Documentation

◆ DialogProc()

static INT_PTR CALLBACK DialogProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 120 of file DM_REPOSITION.c.

121 {
122  switch (uMsg)
123  {
126  }
127  return 0;
128 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT uMsg
Definition: menu.cpp:213
#define WM_COMMAND
Definition: winuser.h:1722
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
Definition: DM_REPOSITION.c:11
#define HANDLE_MSG(hwnd, message, fn)
Definition: windowsx.h:297
#define WM_INITDIALOG
Definition: winuser.h:1721
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)

Referenced by START_TEST().

◆ OnCommand()

static void OnCommand ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)
static

Definition at line 108 of file DM_REPOSITION.c.

109 {
110  switch (id)
111  {
112  case IDOK:
113  case IDCANCEL:
114  EndDialog(hwnd, id);
115  break;
116  }
117 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define IDCANCEL
Definition: winuser.h:825

Referenced by DialogProc().

◆ OnInitDialog()

static BOOL OnInitDialog ( HWND  hwnd,
HWND  hwndFocus,
LPARAM  lParam 
)
static

Definition at line 11 of file DM_REPOSITION.c.

12 {
13  RECT rc, rc2, rcWork;
14  INT cx, cy, nBitsPixel;
15  HMONITOR hMon;
16  MONITORINFO mi = { sizeof(mi) };
17  HDC hdc;
18 
19  /* get monitor info */
20  hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
21  ok(hMon != NULL, "hMon is NULL\n");
22  ok_int(GetMonitorInfoW(hMon, &mi), TRUE);
23  rcWork = mi.rcWork;
24 
25  /* get size */
26  GetWindowRect(hwnd, &rc);
27  cx = rc.right - rc.left;
28  cy = rc.bottom - rc.top;
29 
30  /* move */
31  ok_int(SetWindowPos(hwnd, NULL, rcWork.left - 80, rcWork.top - 80, 0, 0,
33  SWP_NOZORDER), TRUE);
34  ok_int(GetWindowRect(hwnd, &rc), TRUE);
35  ok_long(rc.left, rcWork.left - 80);
36  ok_long(rc.top, rcWork.top - 80);
37  ok_long(rc.right, rc.left + cx);
38  ok_long(rc.bottom, rc.top + cy);
39 
40  /* reposition */
42  ok_int(GetWindowRect(hwnd, &rc), TRUE);
43  ok_long(rc.left, rcWork.left);
44  ok_long(rc.top, rcWork.top);
45  ok_long(rc.right, rc.left + cx);
46  ok_long(rc.bottom, rc.top + cy);
47 
48  /* move */
50  rcWork.right - cx + 80, rcWork.bottom - cy + 80, 0, 0,
52  SWP_NOZORDER), TRUE);
53  ok_int(GetWindowRect(hwnd, &rc), TRUE);
54  ok_long(rc.left, rcWork.right - cx + 80);
55  ok_long(rc.top, rcWork.bottom - cy + 80);
56  ok_long(rc.right, rc.left + cx);
57  ok_long(rc.bottom, rc.top + cy);
58 
59  /* reposition */
61  ok_int(GetWindowRect(hwnd, &rc), TRUE);
62  ok_long(rc.left, rcWork.right - cx);
63  ok_long(rc.top, rcWork.bottom - cy - 4);
64  ok_long(rc.right, rc.left + cx);
65  ok_long(rc.bottom, rc.top + cy);
66 
67  /* minimize */
69  ok_int(GetWindowRect(hwnd, &rc), TRUE);
70 
71  /* reposition */
74  ok_int(EqualRect(&rc, &rc2), TRUE);
75 
76  /* restore */
78 
79  /* move */
81  rcWork.right - cx + 80, rcWork.bottom - cy + 80, 0, 0,
83  SWP_NOZORDER), TRUE);
84  ok_int(GetWindowRect(hwnd, &rc), TRUE);
85  ok_long(rc.left, rcWork.right - cx + 80);
86  ok_long(rc.top, rcWork.bottom - cy + 80);
87  ok_long(rc.right, rc.left + cx);
88  ok_long(rc.bottom, rc.top + cy);
89 
90  /* WM_DISPLAYCHANGE */
91  hdc = GetWindowDC(hwnd);
92  nBitsPixel = GetDeviceCaps(hdc, BITSPIXEL);
93  ReleaseDC(hwnd, hdc);
94  SendMessageW(hwnd, WM_DISPLAYCHANGE, nBitsPixel,
97  ok_int(GetWindowRect(hwnd, &rc), TRUE);
98  ok_long(rc.left, rcWork.right - cx + 80);
99  ok_long(rc.top, rcWork.bottom - cy + 80);
100  ok_long(rc.right, rc.left + cx);
101  ok_long(rc.bottom, rc.top + cy);
102 
103  /* quit */
105  return TRUE;
106 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define BITSPIXEL
Definition: wingdi.h:719
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
static MONITORINFO mi
Definition: win.c:7339
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1232
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_RESTORE
Definition: winuser.h:773
#define ok_long(expression, result)
Definition: atltest.h:133
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
#define SM_CXSCREEN
Definition: winuser.h:949
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define ok_int(expression, result)
Definition: atltest.h:134
#define PostMessage
Definition: winuser.h:5807
#define SM_CYSCREEN
Definition: winuser.h:950
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define SWP_NOACTIVATE
Definition: winuser.h:1227
int WINAPI GetSystemMetrics(_In_ int)
#define SW_MINIMIZE
Definition: winuser.h:770
#define DM_REPOSITION
Definition: winuser.h:2082
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1722
#define SWP_NOSIZE
Definition: winuser.h:1230
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
HDC WINAPI GetWindowDC(_In_opt_ HWND)
#define NULL
Definition: types.h:112
_Out_opt_ int * cx
Definition: commctrl.h:581
LONG bottom
Definition: windef.h:309
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)
static const WCHAR rc2[]
Definition: oid.c:1216
#define SWP_NOOWNERZORDER
Definition: winuser.h:1234

Referenced by DialogProc().

◆ START_TEST()

START_TEST ( DM_REPOSITION  )

Definition at line 130 of file DM_REPOSITION.c.

131 {
132  HMODULE hMod = GetModuleHandle(NULL);
133  ok(hMod != NULL, "\n");
134  DialogBox(hMod, TEXT("REPOSITION"), NULL, DialogProc);
135 }
#define DialogBox
Definition: winuser.h:5736
static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define TEXT(s)
Definition: k32.h:26
#define GetModuleHandle
Definition: winbase.h:3667
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112