Win32 Accelerators not working when not focused

closed account (o1vk4iN6)
I have an accelerator set to ID_FILE_SAVE with "ctrl+s" which works fine but when I have an edit box selected and try to do "ctrl+s" nothing happens, there is no beep sound either. I have to click the main window than press the hotkey.
1
2
3
4
5
6
7
8
9
10
11
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WIN32_CONTROLS));

	
	while (GetMessage(&msg, NULL, 0, 0))
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
case WM_CREATE:
	CreateWindowEx( NULL,
                        "Edit",
                        "text",
                         WS_BORDER | WS_CHILD | WS_VISIBLE,
                         200, 0, 100, 20,
                         hWnd, (HMENU)ID_EDIT1,
                         hInst, NULL);
        break;
case WM_COMMAND:
		wmId    = LOWORD(wParam);
		wmEvent = HIWORD(wParam);

		switch (wmId)
		{
			case ID_FILE_SAVE:
				//opens save file dialog and writes data
				break;

			default:
				return DefWindowProc(hWnd, message, wParam, lParam);
		}
		break;
Topic archived. No new replies allowed.