Using the process window - getting its size etc.

  • Thread starter Thread starter Hogan's Goat
  • Start date Start date
H

Hogan's Goat

Hi, another newbie question on my slow-paced learning curve. :)

I've got this code that's pretty cool in that it gets the title of all
currently running apps and populates a combobox.

Dim objProcess As Process

cboProcessesList.Items.Clear()
For Each objProcess In System.Diagnostics.Process.GetProcesses
If objProcess.MainWindowTitle <> "" Then
cboProcessesList.Items.Add(objProcess.MainWindowTitle)
End If
Next

So far so good. I want to be able to use the selected app from the
combobox to get the screen location of the app and also its height and
width. So basically I want to know the bounding box for the app and its
screen location, and to track it if the user moves it while running my app.

First one to reply gets a free copy of the finished product! :)

Hogan out.
 
* "Hogan's Goat said:
Can you show me an example of how I'd do this?

Quick and Dirty:

\\\
<StructLayout(LayoutKind.Sequential)> _
Private Structure RECT
Public Left, Top, Right, Bottom As Int32
End Structure

Private Declare Auto Function GetWindowRect Lib "user32.dll" ( _
ByVal hwnd As IntPtr, _
ByRef lpRect As RECT _
) As Int32
..
..
..
Dim r As New RECT
If GetWindowRect(<handle>, r) <> 0 Then
MsgBox(r.Left.ToString & ...)
End If
///
 
Back
Top