How do I resize a window? - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How do I resize a window?

vlad777vlad777 Posts: 53Member
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


  • carlycarly Posts: 46Member
    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
  • AsmGuru62AsmGuru62 Posts: 6,519Member
    [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.