I've been trying to implement accelerator keys, and i just cant seem to get them to work. Any help would be appreciated. Here is the relevant code:

--------in resource file-------
AccTable ACCELERATORS DISCARDABLE 
BEGIN
    VK_A, IDM_ADD, VIRTKEY, ALT, NOINVERT
END

-----------in asm file---------
AccTableName           DB "AccTable",0
hAccel                 DD 0

invoke LoadAccelerators,hInstance,ADDR ATableName ;doesn't return 0
mov hAccel,eax

   .WHILE TRUE 
        invoke GetMessage,ADDR Msg,NULL,0,0 
            .BREAK .IF (!eax) 
        invoke TranslateAccelerator,hMainWnd,hAccel,ADDR Msg
            .IF (!eax)
                invoke TranslateMessage,ADDR Msg 
                invoke DispatchMessage,ADDR Msg 
            .ENDIF
    .ENDW 

Posted on 2001-01-23 18:28:00 by martin
Don't see anything. A common mistake, when handling WM_COMMAND, is to compare the entire 32-bits of wParam to your control/accelerator/menu-item ID. The upper 16-bits contains the notification code and, in the case of accelerators, is always 1. You should compare only the lower 16-bits.
Posted on 2001-01-23 19:13:00 by tank