You need to add a WM_SIZE case to the window function. Windows sends a WM_SIZE message to the window function whenever the width or height of a window changes. Since changing the main window size does not automatically change the size of the edit control, the WM_SIZE case is needed to change the size of the control.
Add the following statements to the window function:
case WM_SIZE:
MoveWindow(hEditWnd, 0, 0, LOWORD(lParam),
HIWORD(lParam), TRUE);
break;