Results 1 to 2 of 2

Thread: Send keys and Bring Window To Top

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    US
    Posts
    20

    Post

    I have code like so:

    Dim hWnd As Long
    hWnd = FindWindow("A Program", CLng(0))
    BringWindowToTop hWnd
    SendKeys ("c")

    And I thought that it should set "A Program" as the highlighted or active window and sendkeys would send the keys "to" the program but instead it still sends them to the previously selected program, Any help to get it to send it to "A Program"

    Andy

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Post

    I don't have VB on this computer, so I can't say for sure this works, but try using:
    Code:
    Dim MyAppID as Long
    MyAppID = Shell("A Program", 1)   ' Run the program (use full path plus program name in quotes)
    AppActivate MyAppID   ' Activate the program
    SendKeys ("c")        ' Send "c" to that program
    Good luck,

    ~seaweed

    [This message has been edited by seaweed (edited 02-21-2000).]

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