Your going about this the wrong way, don't change the edit's size inside it's own proc. Change it inside your main window's proc. Also, when msg is WM_SIZE, lParam contains the new window dimensions (So you don't have to call GetClientRect).