Modeless dialogs Vs.TAB key, arrow keys, and accelerator keys

This is something I had to fix some days ago with a modeless dialog, I spent half hour trying to figure out why the PreTranslateMessage wasn't being called. Finally I found out a solution:

http://support.microsoft.com/kb/q187988

After that the PreTranslateMassage will be called. To manage the key states in the PreTranslateMassage should be enough, something like this:


BOOL CFuncViewFindDialog::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN)
{
SHORT nReturnDown = GetKeyState(VK_RETURN) & 0x8000;
SHORT nTabDown = GetKeyState(VK_TAB) & 0x8000;

if (nReturnDown)
{
                      //Your stuff


Comentarios

Entradas populares