Results 1 to 4 of 4

Thread: Sending keystroke to a window

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    79

    Sending keystroke to a window

    I have the window selected, and I have it pop that window up, but now how can I send the number 1 "1" keystroke to it.

    Here is what I have so far to make the window pop up.

    Code:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Const SW_SHOWNORMAL = 1
    Const gcClassnamebow = "bow"
    
    Private Sub Form_Load()
        Dim WinWnd As Long, Ret As String
        Ret = "bow"
        WinWnd = FindWindow(vbNullString, Ret)
        If WinWnd = 0 Then MsgBox "Couldn't find the bow Window": Exit Sub
        ShowWindow WinWnd, SW_SHOWNORMAL
    End Sub
    It all works..just need to know how to send that keystroke.

  2. #2
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    United States
    Posts
    420
    it is very easy just use

    send keys "1"

  3. #3
    Addicted Member Para80d's Avatar
    Join Date
    Oct 2003
    Location
    Denton, TX
    Posts
    160
    Ask around on the API Forum, maybe they can help ya out. But i think that's gonna be the way you're gonna have to go.
    C++/VB6&.NET/QBasic/HTML/PHP/MySQL/SQLServer2k

    I'm the guy your little brother looks a lot alike. Tell your mom i said thanks.

    naked in vegas

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Posts
    79
    Will do, and thanks.

    BTW, sendkeys "1" works, however, once it sends the key, it minimizes back down to my app that I am manilupating the other with, is there a way I can prevent this?

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