0

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!

JessMcintosh
  • 460
  • 2
  • 6
  • 21

1 Answers1

1

'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);
Edward Clements
  • 5,040
  • 2
  • 21
  • 27