Hit Enter in Textfield

Hello, I've created a window via CreateWindowEx
Problem is, I can't detect hitting enter in a txtfield
Enter can only be detected in the window form, but not inside txtfield..
Thanks in advance.
Hello,

You could install an eventFilter on whatever your using for your txtfield.

Regards
1
2
3
4
5
Case WM_CREATE:
txtfield = CreateWindow(L"EDIT", L"",
			WS_VISIBLE | WS_CHILD | WS_BORDER,
			8, 525, 380, 25,
			hwnd, (HMENU)3, NULL, NULL);


how can I check "If user hit enter" inside the txtfield? an example would be highly appreciated,
Thanks in advance.
Have a look at WM_CHAR, if key == VK_RETURN than check if the txtfield is the active window with GetActiveWindow
if (GetActiveWindow == txtfield)
or how do i properly type the statement?
GetActiveWindow returns a handle to a window, so you can compare it with the txtfield
GetActiveWindow() == txtfield
1
2
3
4
5
6
7
8
switch (message)
	{
	case WM_CHAR://Process this message to avoid message beeps.
		if ((wParam == VK_RETURN))
		{
			if (GetActiveWindow() == txtfield)
				cout << "Enter pressed" << endl;
		}


Still no luck in seeing the print (I use console for printing to test)
Maybe txtfield isn't the active window at the moment.
Try GetForegroundWindow instead
Thank you!!
Topic archived. No new replies allowed.