[Win32 API] change text in a text field?

Working with the WinAPI I've got a text box and button set up. I'm trying to make the text in the text field clear when the button is pressed. I presume it's going to be in the WM_COMMAND call using the sendmessage() function, but not sure how the sendmessage() function would accomplish this.

Button Code:
1
2
3
4
HWND clrBtn = CreateWindow("BUTTON", "Clear Text", WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
10, 10, 100, 100,
hWnd, NULL, (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
NULL);


Text Code:
1
2
3
4
mainText = CreateWindow(TEXT("EDIT"), TEXT("Begin typing..."),
WS_VISIBLE | WS_CHILD | WS_BORDER | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_WANTRETURN,
10, 10, 1400, 600,
Window, (HMENU) mainText, NULL, NULL);
Last edited on
Topic archived. No new replies allowed.