Results 1 to 6 of 6

Thread: Capturing and Sending Key Presses

  1. #1
    Guest

    Post

    I am workin in an environment that dous not provide the Key_Press event.

    What I need is an API function that will capture all keys as they are pressed, check if the key is ENTER and if it is send the TAB
    key.

    Thanks in advance

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    You can use the GetAsyncKeyState API to check for vbKeyReturn, then you can send the Tab Key using the SendMessage API with the vbKeyTab Constant, or even use the VB function SendKeys.


    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  3. #3
    Guest

    Post

    Again,
    I am not working in vb but a vb like language.
    Can't use SendKeys.
    And as I understand u need to have the GetAsyncKeyState function executed periodically to perform checking(need timer, don't have it). Is there a way to use GetMessage function to get keys.

    Also, can you leave hWnds at zero(the environment does not provide hWnd to current window through its language).
    I am not exactly sure but I think if they are zero Windooz will try to send message to all parent windows whether they like it or not, correct me if I am wrong.

    Also could you give constants to use for SendMessage and GetMessage.

    Thanks.

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    You don't neccessarily have to use a Timer Control, you could use a Do..Loop

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  5. #5
    Guest

    Post

    The loop will hog the thread. and disallow me to continue other things, the environment can only do one task at a time.

    Another related question.
    if you shell a vb application that will keep track of those keys. How can you kill it.
    Lets say it is a module only executable, no gui.

  6. #6
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Use the Sleep API or DoEvents or even the Timer Function, to time when your Routine Executes.

    You could terminate the Shelled App using the TerminateProcess API.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width