Question

I am creating a WIN32 application. Is there a way I can change the window so that it can maximise to the left or right, as if you pressed win + right arrow or win + left arrow?

I've tried using the ShowWindow() method, but none of the parameters accept left or right maximisation. I've also tried using AdjustWindowRect() using the following code:

AdjustWindowRect(&wr, WS_OVERLAPPEDWINDOW, TRUE);    // adjust the window

where wr is of type RECT, however this does not seem to change the window size or position.

Thanks!

Était-ce utile?

La solution

'AdjustWindowRect' only "Calculates the required size of the window rectangle".

Use the MoveWindow function.

For example, to move the left border of the window to the left edge of the screen:

RECT rc;
GetWindowRect(hWnd, &rc);
MoveWindow(hWnd, 0, rc.top, rc.right, rc.bottom - rc.top, TRUE);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top