- Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
- Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
- Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
- Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
- Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
- Const GW_HWNDFIRST = 0
- Const GW_HWNDNEXT = 2
-
- Private Sub Form_Load()
- Dim CurrWnd As Long
- Dim Length As Long
- Dim TaskName As String
- Dim Parent As Long
- Dim founded() As Long
- CurrWnd = GetWindow(Me.hwnd, GW_HWNDFIRST)
- ReDim founded(0)
- While CurrWnd <> 0
- Parent = GetParent(CurrWnd)
- Length = GetWindowTextLength(CurrWnd)
- TaskName = Space$(Length + 1)
- Length = GetWindowText(CurrWnd, TaskName, Length + 1)
- TaskName = Left$(TaskName, Len(TaskName) - 1)
- If Length <> 0 Then
- If TaskName <> Me.Caption Then
- founded(UBound(founded)) = CurrWnd
- ReDim Preserve founded(UBound(founded) + 1)
- End If
- End If
- CurrWnd = GetWindow(CurrWnd, GW_HWNDNEXT)
- Wend
- ReDim Preserve founded(UBound(founded) - 1)
- Me.Hide
- For i = 0 To UBound(founded)
- MoveWindow founded(i), 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, 1
- Next
- End Sub
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Const GW_HWNDFIRST = 0
Const GW_HWNDNEXT = 2
Private Sub Form_Load()
Dim CurrWnd As Long
Dim Length As Long
Dim TaskName As String
Dim Parent As Long
Dim founded() As Long
CurrWnd = GetWindow(Me.hwnd, GW_HWNDFIRST)
ReDim founded(0)
While CurrWnd <> 0
Parent = GetParent(CurrWnd)
Length = GetWindowTextLength(CurrWnd)
TaskName = Space$(Length + 1)
Length = GetWindowText(CurrWnd, TaskName, Length + 1)
TaskName = Left$(TaskName, Len(TaskName) - 1)
If Length <> 0 Then
If TaskName <> Me.Caption Then
founded(UBound(founded)) = CurrWnd
ReDim Preserve founded(UBound(founded) + 1)
End If
End If
CurrWnd = GetWindow(CurrWnd, GW_HWNDNEXT)
Wend
ReDim Preserve founded(UBound(founded) - 1)
Me.Hide
For i = 0 To UBound(founded)
MoveWindow founded(i), 0, 0, Screen.Width / Screen.TwipsPerPixelX, Screen.Height / Screen.TwipsPerPixelY, 1
Next
End Sub