This program will give you a list of open windows and allow you to put a border around the selected one. This can be useful when making a screenshot or screen capture program.
++Section 1++
=======
Imports System.Runtime.InteropServices
=======
Private Declare Function GetWindowRect Lib "User32.dll" (ByVal handle As Integer, ByRef rect As RECT) As Integer
[LESS_THEN_SIGN]System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)[GREATER_THEN_SIGN]
Private Structure RECT
Public Left As Integer
Public Top As Integer
Public Right As Integer
Public Bottom As Integer
End Structure
=======
++Section 2++
=======
Dim r As RECT
GetWindowRect(p.MainWindowHandle.ToInt32, r)
Form2.GroupBox1.Location = New Point(r.Left, r.Top)
Form2.GroupBox1.Size = New Size(r.Right - r.Left, r.Bottom - r.Top)
Form2.GroupBox1.Text = ListBox1.SelectedItem
Form2.BringToFront()
=======