Results 1 to 5 of 5

Thread: Sending Keystrokes

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    how do i send keystrokes to a non-active application.





    Kurt Simons
    [I know I'm a hack but my clients don't!]

  2. #2
    Guest
    Do you mean using the SendKey's method?

    Code:
    AppActivate "Untitled - Notepad"
    SendKeys "ABC"

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Yes,

    but I need to do it in the background...



    I need to telnet into a system using the windows telnet application. Start a log file send the commands and get my data that will then output in a text file

    There must be an API for sending a keystroke to a certain window

    [Edited by kurtsimons on 08-01-2000 at 10:06 AM]
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    Any Ideas?
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  5. #5
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Use the MouseEvent Api

    Code:
    Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    Private Const MOUSEEVENTF_ABSOLUTE = &H8000
    Private Const MOUSEEVENTF_LEFTDOWN = &H2
    Private Const MOUSEEVENTF_LEFTUP = &H4
    Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
    Private Const MOUSEEVENTF_MIDDLEUP = &H40
    Private Const MOUSEEVENTF_MOVE = &H1
    Private Const MOUSEEVENTF_RIGHTDOWN = &H8
    Private Const MOUSEEVENTF_RIGHTUP = &H10
    Private Const MOUSEEVENTF_WHEEL = &H80
    Private Const MOUSEEVENTF_XDOWN = &H100
    Private Const MOUSEEVENTF_XUP = &H200
    Private Const WHEEL_DELTA = 120
    Private Const XBUTTON1 = &H1
    Private Const XBUTTON2 = &H2
    
    Sub Main()
        'PURPOSE: Press and then release the left mouse button.
        Dim int_Coordinates As Integer
        Call mouse_event(MOUSEEVENTF_LEFTDOWN, int_Coordinates, int_Coordinates, 0, 0)
        Call mouse_event(MOUSEEVENTF_LEFTUP, int_Coordinates, int_Coordinates, 0, 0)
    end Sub
    Chemically Formulated As:
    Dr. Nitro

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