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!

Categories

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
arrow keys VK_UP,VK_DOWN,VK_LEFT,VK_RIGHT.


Comments

  • 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
    (news://nntp.aioe.org/comp.os.ms-windows.programmer.win32)
  • 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();
    [/color]
Sign In or Register to comment.