WM_KEYDOWN event not being called

0

I'm developing a simple program in C ++ just for testing with a GUI but it is not calling the WM_KEYDOWN event, the program is based on dialog. The graphical interface was created through ResEdit. Could someone tell me why? Below his main code:

#include <windows.h>
#include <commctrl.h>
#include "resource.

BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
        case WM_INITDIALOG:
        {
            return TRUE;
        }

        case WM_KEYDOWN: // problema aqui
        {
            if(LOWORD(wParam) == VK_ESCAPE)
            {
                PostMessage(hwndDlg, WM_CLOSE, 0, 0);
            }
            return TRUE;
        }

        case WM_CLOSE:
        {
            if(MessageBox(hwndDlg, "Você deseja realmente sair?", "Confirmação", MB_OKCANCEL | MB_ICONQUESTION) == IDOK) {
                EndDialog(hwndDlg, 0);
            }

            return TRUE;
        }

        case WM_COMMAND:
        {
            switch(LOWORD(wParam))
            {
                case ID_LEAVE:
                {
                    SendMessage(hwndDlg, WM_CLOSE, 0, 0);
                    return TRUE;
                }
            }
            return TRUE;
        }
    }
    return FALSE;
}


int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
    InitCommonControls();
    return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DlgMain);
}
    
asked by anonymous 18.09.2017 / 16:46

0 answers