Because Windows sends a WM_SIZE message to the window procedure whenever the width or height of a window changes, you must add a WM_SIZE case to the window procedure. Changing the main window size does not automatically change the size of the edit control. The WM_SIZE case is necessary to change the size of the control.
Add the following statements to the window procedure:
case WM_SIZE:
MoveWindow(hEditWnd, 0, 0, LOWORD(lParam),
HIWORD(lParam), TRUE);
break;