Win32 API Window messages WM_SIZE


Example

This message is sent to the window's window procedure after it's size has changed. The most common reason for handling this message is to adjust the position of any child windows. For example, in Notepad, when the window is resized the child window (edit control) is also resized. Return 0 if you handle this message.

ArgumentValue
wpOne of the window sizing constants.
lpLOWORD(lp) is the new width of the client area
HIWORD(lp) is the new height of the client area.
LRESULT CALLBACK winproc(HWND hwnd, UINT wm, WPARAM wp, LPARAM lp)
{
    switch (wm) {
        case WM_SIZE:
            /* hwndEdit is the handle of the edit control window */
            MoveWindow(hwndEdit, 0, 0, LOWORD(lp), HIWORD(lp), TRUE);
            return 0;
   }
   return DefWindowProc(hwnd, wm, wp, lp);
}