News:

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

how to make a simple keypress in asm?

Started by dymyker46, March 23, 2009, 09:03:15 AM

Previous topic - Next topic

dymyker46

how to make a simple keypress in asm?

if i have a button "Y" and acts as similar as sendkeys with time delays...when i press the button it will send a "Y"
how to write it in asm?

thanks...

Neil

It looks as if you are trying to lock the keyboard, you need to give a bit more information on what you are trying to do.
Have you written any code?


dymyker46

i am thankfull that somebody reply on my thread...

honesty... im still study right now asm... in online tutorials.. and still gathering information..

pertaining to my question... i tried "keybd_event Function" but still it doesnt work...

i am making a program from asm to send a key throu press button event... similiar to OSK.exe but i need to
customize it for may conformity...

thanks again...

Tedd

You'll have to show us your code so we can help you with that - otherwise we don't know why it doesn't work :wink
No snowflake in an avalanche feels responsible.

dymyker46

thanks for the reply Tedd.

im still a beginner, actually i dont know how to make one except hello world.. im still study...

on other hand, is there away to make it readable asm files...?? because i only know VB programming...

thanks

dsouza123

Maybe it is a program like the On-screen keyboard in Win XP ?

When used along with a text editor, set the focus to the editor,
then clicking on the screen keys will send keys to the editor.

dymyker46

Quote from: dsouza123 on March 25, 2009, 11:10:27 PM
Maybe it is a program like the On-screen keyboard in Win XP ?


yes dsouza, kindah... still studying asm right now... low progress...  :(

ToutEnMasm


Prefered method is using an ACCELERATORS table

Further steps are needed

in the rc file

Quote
      // Accelerators table   54 et 55 are numbers of command
      // ctrl+space shift+insert
      SDIDEMO ACCELERATORS DISCARDABLE
      BEGIN
      VK_SPACE,54, VIRTKEY, CONTROL, NOINVERT
      VK_INSERT,55,VIRTKEY, SHIFT, NOINVERT
      END

at the beginning of the source code,you need to load this resource
Quote
      invoke LoadAccelerators,hInstance,SADR("SDIDEMO")
      mov Haccel,eax
              ;in the WM_COMMAND message
      .elseif eax == 54
      ;do something

Finally,you must insert a piece of code in the messages loop

Quote
      @@:
      INVOKE GetMessage, addr msg,0, 0, 0
      .if eax != 0 && eax != INVALID_HANDLE_VALUE ;WM_QUIT ou crash
      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

You must modify this pieces of code with your own name of variables ,see winhelp or better the SDK for this