The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: trodon on August 08, 2006, 02:55:30 PM

Title: executing some button???
Post by: trodon on August 08, 2006, 02:55:30 PM
can someone explain me how to execute some key or combination key  from keyboard?
for example R, CTRL+ALT+DEL etc...
thanks
Title: Re: executing some button???
Post by: ToutEnMasm on August 08, 2006, 03:39:38 PM
Hello,
create an accelerator table in the resouce
54 and 55 are the value of the command


Quote
//----------- pour appeler un menu par configuration de touches ------------------
// Accelerators
// ctrl+space   shift+insert
SDIDEMO   ACCELERATORS   DISCARDABLE
BEGIN
   VK_SPACE,54,   VIRTKEY, CONTROL, NOINVERT
   VK_INSERT,55,VIRTKEY, SHIFT, NOINVERT
END   

at start of code
Quote
   invoke   LoadAccelerators,hInstance,SADR("SDIDEMO")
   mov Haccel,eax

at WM_COMMAND
   .elseif eax == 54
                  ;do something



In the waiting loop

Quote
;################################################################
Waiting_Loop PROC
         local msg :MSG
         Local  retour:DWORD
         mov retour,1
   @@:
   INVOKE     GetMessage, addr msg,0, 0, 0
   .if eax != 0  && eax != INVALID_HANDLE_VALUE     ;WM_QUIT  ou crash   ,quitter sur commande quit
      invoke TranslateAccelerator,hWnd,Haccel, ADDR msg;keyboard events  en WM_COMMAND
      INVOKE     TranslateMessage, addr msg           ;get the message
      INVOKE     DispatchMessageA , addr msg          ;send les messages aux fenêtres         
      jmp @B
   .endif
   
   quitte:
   PuPo retour, msg.wParam   
FindeWaiting_Loop:
         mov eax,retour
         ret
Waiting_Loop endp
                         ToutEnMasm


Title: Re: executing some button???
Post by: trodon on August 08, 2006, 04:24:47 PM
yeah, right.
thanks man  :U