ReactOS 0.4.15-dev-8231-g29a56f3
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}
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
Definition: DM_REPOSITION.c:11
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define HANDLE_MSG(hwnd, message, fn)
Definition: windowsx.h:322
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739

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}
#define IDCANCEL
Definition: winuser.h:831
#define IDOK
Definition: winuser.h:830
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

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,
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 */
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,
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 */
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 */
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,
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 */
92 nBitsPixel = GetDeviceCaps(hdc, BITSPIXEL);
94 SendMessageW(hwnd, WM_DISPLAYCHANGE, nBitsPixel,
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}
#define ok_long(expression, result)
Definition: atltest.h:133
#define ok(value,...)
Definition: atltest.h:57
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static const WCHAR rc2[]
Definition: oid.c:1216
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
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
#define MAKELONG(a, b)
Definition: typedefs.h:249
static MONITORINFO mi
Definition: win.c:7338
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define BITSPIXEL
Definition: wingdi.h:720
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SWP_NOACTIVATE
Definition: winuser.h:1242
HDC WINAPI GetWindowDC(_In_opt_ HWND)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SM_CYSCREEN
Definition: winuser.h:960
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SW_MINIMIZE
Definition: winuser.h:776
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1245
#define PostMessage
Definition: winuser.h:5841
#define SWP_NOOWNERZORDER
Definition: winuser.h:1249
#define SW_RESTORE
Definition: winuser.h:779
#define SM_CXSCREEN
Definition: winuser.h:959
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define SWP_NOZORDER
Definition: winuser.h:1247
#define DM_REPOSITION
Definition: winuser.h:2100
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by DialogProc().

◆ START_TEST()

START_TEST ( DM_REPOSITION  )

Definition at line 130 of file DM_REPOSITION.c.

131{
133 ok(hMod != NULL, "\n");
134 DialogBox(hMod, TEXT("REPOSITION"), NULL, DialogProc);
135}
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:3827
#define DialogBox
Definition: winuser.h:5770