Results 1 to 2 of 2

Thread: Controlsend keys [to not active window]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2008
    Posts
    74

    Controlsend keys [to not active window]

    I understand that i cant use SendKeys.SendWait("sampletext") to send keys to not active window. is there any other way can I do this?
    Code:
                Dim ProcID As Integer
                ProcID = Shell("notepad.EXE")
    
                ControlSend ( "title", controlID, "string"
    
                title - The title of the window to access. 
                controlID - Send text to the 1st Edit control in the Notepad window 
                String - of characters to send to the control.
    
                ControlSend("Untitled - Notepad", "Edit1", "sampletext"
                ControlSend("Untitled - Notepad", "[CLASSNN:Edit1]", "sampletext")
                ControlSend("Untitled - Notepad", "[CLASS:Edit; INSTANCE:1]", "sampletext")
    Last edited by goldenix; Apr 10th, 2008 at 07:14 PM.

    M.V.B. 2008 Express Edition

  2. #2
    Hyperactive Member cameron2's Avatar
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    401

    Re: Controlsend keys [to not active window]

    If your trying to send text or something to an inactive window its best to use the sendmessage api as it can be used to send text, get text , click a button etc. to a specific window even if it is inactive.

    Declaration:
    Code:
    Private Declare Auto Function SendMessage Lib "user32.dll" Alias "SendMessage" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr
    However if you were to use sendmessage you would need to use findwindow:
    Code:
    rivate Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
    Now i know this looks comlicated it sure was for me but try them out and they can be really helpful!
    If this post helped you, please click the rate button to say thank you! Remember to mark the thread as resolved too.
    Autoclicker, Hide Taskbar, Sounds on internal speaker, Changing Start Button Text (with code)

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