Is there a built in function for accelerator keys in RadASM or a plugin for them, the reason I ask is that I am not able to get them working. I have attached some peices of code to demonstrate what I'm doing and if someone could shed some light on my error I would appreciate it.

DONKEY (I postthis for him since he has troubles logging in XP + IE6, anybody else experiencing this have the solution maybe?)



;There are no errors compiling my rc files the following is from the compiler output

Writing ACCELERATOR:200, lang:0x409, size 32.
;##################################
other res compiling messages here
;##################################
Make finished.

;From the Menu.rc file (In the Res subfolder)

#define IDR_MENU 10000
#defineIDM_OPENCAT 10002
#define IDM_SAVECAT 10003
#define IDM_OPENLIST 10005
#define IDM_SAVELIST 10006

IDR_MENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "Open Catalog\tCtrl+O",IDM_OPENCAT
MENUITEM "Save Catalog\tCtrl+S",IDM_SAVECAT
MENUITEM SEPARATOR
MENUITEM "Open List\tShift+Ctrl+O",IDM_OPENLIST
MENUITEM "Save List\tShift+Ctrl+S",IDM_SAVELIST
END
END

;From the main rc file

#include <Res\Menu.rc>
#define IDR_ACCEL 200
IDR_ACCEL ACCELERATORS DISCARDABLE
BEGIN
"O",IDM_OPENCAT,VIRTKEY,CONTROL,NOINVERT
"S",IDM_SAVECAT,VIRTKEY,CONTROL,NOINVERT
"O",IDM_OPENLIST,VIRTKEY,SHIFT,CONTROL,NOINVERT
"S",IDM_SAVELIST,VIRTKEY,SHIFT,CONTROL,NOINVERT
END

;From the declarations
.const
IDR_MENU equ 10000
IDR_ACCEL equ 200
.data
NoAccel BYTE "The accelerators were not loaded",0
.data?
hAccel HANDLE ?

;The WinMain message loop, no compiling errors, everything works fine except the accelerators

WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD

;##################################
;Setup the window class and show the dialog here.
;The following is included in my window class statements

mov wc.lpszMenuName,IDR_MENU
;##################################

invoke LoadAccelerators,hInstance,IDR_ACCEL
mov hAccel,eax

.IF hAccel == NULL
; this message is never displayed indicating the accelerators are loading properly
invoke MessageBox,NULL,ADDR NoAccel,NULL,MB_OK
.endif

.WHILE TRUE
INVOKE GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke IsDialogMessage, hDlg, ADDR msg
.IF (!eax)
invoke TranslateAccelerator,hDlg,hAccel,addr msg
.IF (!eax)
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.ENDIF
.ENDIF
.ENDW
mov eax,msg.wParam
ret
WinMain endp

;This WndProc processes the WM_COMMAND message correctly but there is no WM_COMMAND message issused for accel keys.
;I used the following code to determine if I received a WM_COMMAND message, yes in the case of menu items no for accelerators

.ELSEIF uMsg == WM_COMMAND
invoke MessageBox,NULL,ADDR NoAccel,NULL,MB_OK

Posted on 2002-10-19 09:56:29 by Hiroshimator
Hi

Change:

	invoke IsDialogMessage, hDlg, ADDR msg

.IF (!eax)
invoke TranslateAccelerator,hDlg,hAccel,addr msg
.IF (!eax)


To:



invoke TranslateAccelerator,hDlg,hAccel,addr msg
.IF (!eax)
invoke IsDialogMessage, hDlg, ADDR msg
.IF (!eax)


Please don't ask me why.

Here is a working example.

KetilO
Posted on 2002-10-19 10:45:26 by KetilO