Author Topic: Radasm UpdateAccelerator  (Read 2437 times)

ragdog

  • Member
  • ****
  • Posts: 610
Radasm UpdateAccelerator
« on: August 23, 2014, 07:28:50 PM »
Hello Again

I try to change the Accelerator from Menu to call my Function

This works fine
Code: [Select]
mov eax,IDM_FILE_NEW
invoke UpdateAccelerator,eax,VK_F11,FVIRTKEY or FNOINVERT

Code: [Select]

UpdateAccelerator proc uses ebx esi,nID:DWORD,nKey:DWORD,nMod:DWORD
LOCAL hMem:HGLOBAL
LOCAL nAccel:DWORD

mov ebx,lpHandles
invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,16384
mov hMem,eax
invoke CopyAcceleratorTable,[ebx].ADDINHANDLES.hAccel,NULL,0
mov nAccel,eax
invoke CopyAcceleratorTable,[ebx].ADDINHANDLES.hAccel,hMem,nAccel
invoke DestroyAcceleratorTable,[ebx].ADDINHANDLES.hAccel
mov eax,nAccel
mov edx,sizeof ACCEL
mul edx
mov esi,hMem
lea esi,[esi+eax]
mov eax,nMod
mov [esi].ACCEL.fVirt,al
mov eax,nKey
mov [esi].ACCEL.key,ax
mov eax,nID
mov [esi].ACCEL.cmd,ax
inc nAccel
invoke CreateAcceleratorTable,hMem,nAccel
mov [ebx].ADDINHANDLES.hAccel,eax
invoke GlobalFree,hMem
ret

UpdateAccelerator endp


Why can i not use my Id from Allocated new menu id ?

Code: [Select]
invoke SendMessage,hWin,AIM_GETMENUID,0,0
mov IDAddIn,eax
mov eax,IDAddIn
invoke UpdateAccelerator,eax,VK_F11,FVIRTKEY or FNOINVERT

Is this a bug?


Regards,
« Last Edit: August 23, 2014, 09:06:25 PM by ragdog »

ragdog

  • Member
  • ****
  • Posts: 610
Re: Radasm UpdateAccelerator
« Reply #1 on: August 24, 2014, 05:32:56 AM »
Solved

.if eax==IDAddIn && edx==BN_CLICKED was my Mistake  ::)