Large textarea?

Hello! I'm very new to C++ especially the Windows API. I have a background in web developement (html, css, javascript, php). So I get the basic fundmentals and how things work of course. I'm just very new to this specific language. Now currently I'm trying to make a text editor, I have this created:
1
2
3
hText = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
                WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL,
                0, 0, 500, 500, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);

That just creates a 500x500 pixel text area in my window. (my window takes the screen size and divides it by two for the first display point to be half the screen size.) So I want to I suppose get the size of my Window and have my textarea auto adjust to it so it covers all the window space. If anyone has any idea how it would be awesome if you could help me out, thanks!
(Sorry if I seem very noob and vague please ask questions.)
Obtain the parent window's client area dimensions using GetClientRect() using the parent window's HWND, then use those in your call to CreateWindowEx(). But you also have to adjust the EDIT's size if your window changes size. So see if you always get a WM_SIZE after window creation. If you do, then just program resizing during WM_SIZE and don't do anything on WM_CREATE.

On WM_SIZE do the same: Obtain the parent's client area dimensions and then use them in a call to MoveWindow() or SetWindowPos(), this time using the HWND of the EDIT control. You can obtain this HWND by using GetDlgItem() (it works even if your window is not a dialog window) or you can have your hText variable there to be accessible at all times (global variable? Not advised but works).
Topic archived. No new replies allowed.