Hello everyone, I am new :)

Recently I began discovering asm and actually I am trying to convert a high-level language project of mine to assembler.. and I am stuck implementing Accelerators. Less words, more code, that's what I try to make it work (using masm32 by the way):

Resource:
650 ACCELERATORS DISCARDABLE 
BEGIN
"O",601,VIRTKEY,NOINVERT,CONTROL
"X",602,VIRTKEY,NOINVERT,CONTROL
END


Program:
.data
...
hAccel    dd 0

.code
...
invoke  LoadAccelerators,hInst,650
mov    hAccel,eax
...
StartLoop:
invoke  GetMessage,ADDR msg,NULL,0,0
cmp    eax,0
je      ExitLoop
invoke  TranslateAccelerator,hwnd,hAccel,ADDR msg
cmp    eax,0
jne    StartLoop
invoke  TranslateMessage,ADDR msg
invoke  DispatchMessage,ADDR msg
jmp    StartLoop
ExitLoop:
mov    eax,msg.wParam
ret
...
WndProc proc hwnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
mov    eax,uMsg
.IF    eax==WM_COMMAND
mov    eax,wParam
.IF    eax==601 ;Open File
invoke  MessageBox,hwnd,ADDR AppName,ADDR AppName,MB_OK
.ELSEIF eax==602 ;Exit
invoke  SendMessage,hwnd,WM_SYSCOMMAND,SC_CLOSE,NULL
.ELSEIF eax==603 ;About
invoke  MessageBox,hwnd,ADDR ClassName,ADDR AppName,MB_OK
.ENDIF

.ELSEIF eax==WM_INITDIALOG
...


After a considerable time of research and modification attempts I am still not able to make it run properly nor do I understand what causes the problem.
I would appreciate it if someone could push me into the right direction.. it must be a pretty silly and facile fault I am overlooking.

Thanks in advance, Hawkin.
Posted on 2006-12-18 16:29:38 by Hawkin
if you wish to catch accelerator, then you have to compare ax (instead eax) with command id (high word of wParam is notification details, it has to be "1" for accelerator)
Posted on 2006-12-19 05:16:16 by Shoo