Help needed on VB initiated keypress.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jackal
    New Member
    • Oct 2007
    • 1

    Help needed on VB initiated keypress.

    Greetings.
    I have an application running that I need to send the keypress "F6" to. I have code to find the app, but I cannot seem to get any keypresses sent to it. This is what I have so far:
    _______________ _______________ _______________ _________
    Private Declare Function FindWindow Lib "user32" Alias "FindWindow A" _
    (ByVal lpClassName As String, _
    ByVal lpWindowName As Long) _
    As Long
    _______________ _______________ _______________ __________
    Private Sub Command1_Click( )
    currentwindow = FindWindow("BA1 FrameWindow", 0)

    End Sub
    _______________ _______________ _______________ _________
    I need to insert some code into this that will fire the "F6" key.
    Any help will be greatly appreciated! Thanks!
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    You can use the SendKeys statement to send a keypress. But you can't "aim" - it will go to whatever application has the focus.

    Comment

    • shaileshb
      New Member
      • Jun 2007
      • 27

      #3
      You can use SendKeys statement.

      SendKeys "{F6}"
      Last edited by Killer42; Oct 17 '07, 09:29 PM.

      Comment

      Working...