News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

executing some button???

Started by trodon, August 08, 2006, 02:55:30 PM

Previous topic - Next topic

trodon

can someone explain me how to execute some key or combination key  from keyboard?
for example R, CTRL+ALT+DEL etc...
thanks

ToutEnMasm

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



trodon