Are you sure about it? I tried resizing window in all the possible ways (left, right, top, bottom, diagonal) and never got it to put non-0 value in left or top.
The docs says that top and left will be 0, two times!
1)
Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).
2)
The left and top members are zero.
Here's test code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 | #include <windows.h>
#include <stdio.h>
static LRESULT WINAPI wproc(HWND window, UINT message, WPARAM wparam, LPARAM lparam)
{
if (message == WM_SIZE)
{
RECT rect;
GetClientRect(window, &rect);
if (rect.left != 0 || rect.top != 0)
{
printf("left=%u, top=%u\n", rect.left, rect.top);
}
return 0;
}
else if (message == WM_DESTROY)
{
PostQuitMessage(0);
return 0;
}
return DefWindowProcW(window, message, wparam, lparam);
}
int main()
{
WNDCLASSW wc =
{
.lpfnWndProc = wproc,
.lpszClassName = L"test",
};
RegisterClassW(&wc);
HWND window = CreateWindowW(wc.lpszClassName, L"test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
BOOL ret;
MSG msg;
while (GetMessageW(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
}
|