user6336941 user6336941 - 26 days ago 9
C Question

Set Width and Height As 100% For an Edit Control

How do I make an Edit Control have its width and height as 100% of the window.

A good example of this is the Edit Control in Notepad.

Up till now, I've been setting the size of controls in the CreateWindow() function as static integers.

e.g.

CreateWindow("EDIT", NULL, WS_CHILD | WS_VISIBLE,
0, 0, 640, 480, hWnd, NULL, NULL, NULL);


I am using C and Visual Studio 2015.

Thanks in advance.

Answer

You have to handle WM_SIZE messages in your main window procedure and use SetWindowPos API call to resize an edit control.