How do I resize a window?

How do I resize a window?

I did all the nesesery job for most basic window:
- wrote a basic Window Procedure
- wrote a basic winmain procedure
- declared WNDCLASS and initialised its filds,
- ::RegisterClass (&wndClass)
- hwnd = ::CreateWindow()
- wrote a basic message loop

I know how to use WM_KEYDOWN message and WParam,
so I would like to resize window using cursor


  • It's a Win32 FAQ (you should be aware that you're not the fist person resizing a window... for 30 years !)
    See on Professional Win32 api group
  • [color=Blue]In response to a key press perform the following:

    1. Call GetWindowRect() to get the current window rectangle
    2. Adjust the coordinate of a returned rectangle according to a key code:

    VK_LEFT - decrease the RECT.right by 8 pixels
    VK_RIGHT - increase the RECT.right by 8 pixels

    VK_UP - decrease the RECT.bottom by 8 pixels
    VK_DOWN - increase the RECT.bottom by 8 pixels

    3. Use the adjusted rectangle in a call to MoveWindow();
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!