Solved

Get Process -> Get Children -> How do I get the information of buttons, sliders, listview on a different application.

Posted on 2008-10-05
2
312 Views
Last Modified: 2012-06-27
I know how to capture Itunes ID and get information and child processes  then I want to be able to actually read all the items in the list view.  If possible.

I'm looking to enumerate to the max and get information on a different application.  Like how many buttons, sliders, listview and its detial.




I start with

        Dim item As ListViewItem

        For Each p As Process In Process.GetProcesses

            item = New ListViewItem

            item.Text = p.Id

            item.SubItems.Add(p.ProcessName)

            Me.ListView1.Items.Add(item)

        Next

Or for more information
 

        Dim p As Process

        Dim items(5) As String

        Dim r As New RECT()
 

        ListAll.Enabled = False

        ListView1.BeginUpdate()

        ListView1.Items.Clear()

        For Each p In Process.GetProcesses

            items(0) = p.ProcessName

            items(1) = p.Id.ToString

            If Not IntPtr.Zero.Equals(p.MainWindowHandle) Then

                items(2) = p.MainWindowHandle.ToString

                If GetWindowRect(p.MainWindowHandle, r) <> 0 Then

                    If IsIconic(p.MainWindowHandle) = 0 Then

                        items(3) = "(" & r.Left.ToString & ", " & r.Top.ToString & ")"

                        items(4) = (r.Right - r.Left).ToString & "x" & (r.Bottom - r.Top).ToString

                    Else

                        items(3) = "[Minimized]"

                        items(4) = "[Minimized]"

                    End If

                Else

                    items(3) = "[Error]"

                    items(4) = "[Error]"

                End If

                items(5) = p.MainWindowTitle

            Else

                items(2) = ""

                items(3) = ""

                items(4) = ""

                items(5) = ""

            End If
 

            ListView1.Items.Add(New ListViewItem(items))

Open in new window

0
Comment
Question by:vaultworld
2 Comments
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 250 total points
ID: 22648835
If you want to know what controls are inside any Window, the you can use the GetWindow Win32 API function. With this function you can obtain all the hWnd of the child window of any parent window, and with recursivity, you can finally obtain all the hWnd contained in a Window and all of their contained sub-windows (i.e. controls).

For each hWnd you obtain, you can use GetClassName to get the class name of the window. With this data you can know if the window is a button, a slider, a listview, etc.

Hope that helps.
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 250 total points
ID: 22650529
It is better to use EnumerateChildWindows.  It is possible for GetWindow can get into a state where it will go into an infinite loop.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
WPF - Tooltips for ComboBox items 5 40
What .NET URL re-routing tool did I use? 2 38
VB6 ListBox Question 4 34
Help with LINQ and XML 10 28
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now