Getting window info and controlling other apps windows using VB (like AutoIt does)

I need to know how to get information from another app's windows kind of like AutoIt does. I do not want to use the AutoIt COM object. Basically, after I get a window's handle, I want to then be able to read different things from the window like perhaps the contents of a specific label. Then, I would also like to be able to simulate a mouse click on a specific button. I'd prefer the code for VB6, but if anybody has the VB.NET code to do this, that could help me for future reference.
LVL 13
Aaron FeledyDrupal Developer and ConsultantAsked:
Who is Participating?
William ElliottConnect With a Mentor Sr Tech GuruCommented:
i think findwindow is the main one you are looking for,.. but these all may help
Public Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Public Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Public Declare Function IsWindow Lib "user32" _
(ByVal hwnd As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, _
ByVal bInheritHandle As Long, _
ByVal dwProcessId As Long) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" _
(ByVal hwnd As Long, _
lpdwProcessId As Long) As Long

Open in new window

Aaron FeledyDrupal Developer and ConsultantAuthor Commented:
Looks good, thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.