Here is my source so far:
- My variables/imports/required functions
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Public Class Form1
Public Delegate Function CallBack(ByVal hwnd As Integer, ByVal lParam As Integer) As Boolean
Public Declare Function EnumWindows Lib "user32" (ByVal Adress As Callback, ByVal y As Integer) As Integer
Public Declare Function IsWindowVisible Lib "user32.dll" (ByVal hwnd As IntPtr) As Boolean
Private Const SW_HIDE As Integer = 0
Private Const SW_RESTORE As Integer = 9
Private hWnd As Integer
Public selectedIndex As Integer
Private ActiveWindows As New System.Collections.ObjectModel.Collection(Of IntPtr)
<DllImport("User32")> Private Shared Function ShowWindow(ByVal hwnd As Integer, ByVal nCmdShow As Integer) As Integer
End Function
-Here is the main function for getting the window's handle
Public Function GetActiveWindows() As ObjectModel.Collection(Of IntPtr) ListView1.Items.Clear() EnumWindows(AddressOf Enumerator, 0) Return ActiveWindows End Function Private Function Enumerator(ByVal hwnd As IntPtr, ByVal lParam As Integer) As Boolean If IsWindowVisible(hwnd) Then ListView1.Items.Add(hwnd) End If Return True End Function
As you can see it just lists the window's handle in my listview control just by calling GetActiveWindows()
So how do I get the window's text?
Thanks!
This post has been edited by tension: 19 June 2009 - 01:10 AM

New Topic/Question
Reply




MultiQuote







|