Programming Tips - Win32: how to pragmatically resize a window

Date: 2008jul7 Platform: win32 OS: Windows Level: beginner Language: C/C++ Q. Win32: how to pragmatically resize a window A. Use the MoveWindow() function. Somewhat inconveniently, this requires the position of the window (x,y) so you can not just set the size of a window. If you only to want to simply set the width and height of a window you need to first get the width in order to call MoveWindow().
const BOOL bRepaint = TRUE; ::MoveWindow(hwnd, x, y, width, height, bRepaint);