Hallo,
ich habe Große Schwierigkeiten daran, alle Fenster eines Aktiven Prozesses in den Vordergrund zu bringen.
Wie man ein alle Fenster auflisten kann, habe ich mittlerweile durch Google herausgefunden.
Spoiler anzeigen
Hat hier einer einer Fertiglösung?
Ich würde bei Funktionalität 5€ per Paypal zahlen.
ich habe Große Schwierigkeiten daran, alle Fenster eines Aktiven Prozesses in den Vordergrund zu bringen.
Wie man ein alle Fenster auflisten kann, habe ich mittlerweile durch Google herausgefunden.
VB.NET-Quellcode
- Public Class Form1
- Public Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As _
- EnumWindowsProc, ByVal lParam As Int32) As Int32
- Public Declare Function IsWindowVisible Lib "user32.dll" (ByVal hwnd As _
- IntPtr) As Boolean
- Public Delegate Function EnumWindowsProc(ByVal hwnd As IntPtr, ByVal lParam _
- As Int32) As Boolean
- Public Declare Function GetWindowText Lib "user32.dll" Alias _
- "GetWindowTextA" (ByVal hwnd As IntPtr, ByVal lpString As String, ByVal cch _
- As Int32) As Int32
- Public Declare Function GetWindowTextLength Lib "user32.dll" Alias _
- "GetWindowTextLengthA" (ByVal hwnd As IntPtr) As Int32
- Public Declare Function GetWindowLong Lib "user32.dll" Alias _
- "GetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Int32) As Int32
- Public Declare Function GetParent Lib "user32.dll" (ByVal intptr As IntPtr) _
- As IntPtr
- Public Const GWL_HWNDPARENT As Int32 = -8
- Private newwindowlist As List(Of String)
- Private Function EnumWinProc(ByVal hwnd As IntPtr, ByVal lParam As Int32) _
- As Boolean
- If IsWindowVisible(hwnd) Then
- If GetParent(hwnd) = IntPtr.Zero Then
- If GetWindowLong(hwnd, GWL_HWNDPARENT) = 0 Then
- Dim str As String = String.Empty.PadLeft( _
- GetWindowTextLength(hwnd) + 1)
- GetWindowText(hwnd, str, str.Length)
- If Not String.IsNullOrEmpty(str.Substring(0, str.Length - _
- 1)) Then newwindowlist.Add(str.Substring(0, str.Length - _
- 1))
- End If
- End If
- End If
- EnumWinProc = True
- End Function
- Private Sub RefreshWindowList()
- newwindowlist = New List(Of String)
- EnumWindows(AddressOf EnumWinProc, CInt(True))
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _
- System.EventArgs) Handles Button1.Click
- RefreshWindowList()
- ListBox1.Items.Clear()
- For Each item As String In newwindowlist
- ListBox1.Items.Add(item)
- Next
- End Sub
- Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
- End Sub
- End Class
Hat hier einer einer Fertiglösung?
Ich würde bei Funktionalität 5€ per Paypal zahlen.