|
-
Apr 10th, 2008, 07:02 PM
#1
Thread Starter
Lively Member
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
-
Apr 10th, 2008, 07:07 PM
#2
Hyperactive Member
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|