Korrektur!
21.01.2009 15:32:09
Tino
Hallo,
habe irgendwie ein bar Deklarierungen gelöscht.
Option Explicit
Private Declare Function GetDesktopWindow Lib "user32" () 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 GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, ByVal wIndx As _
Long) As Long
Private Declare Function ShowWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function GetWindow Lib "user32" _
(ByVal hWnd As Long, ByVal wCmd As Long) As Long
Const GW_HWNDFIRST = 0
Const GW_HWNDLAST = 1
Const GW_HWNDNEXT = 2
Const GW_HWNDPREV = 3
Const GW_OWNER = 4
Const GW_CHILD = 5
Const GW_MAX = 5
Const iNormal As Long = 1
Const iMinimized As Long = 2
Const iMaximized As Long = 3
Const GWL_STYLE = (-16)
Private Function GetWindowInfo(ByVal hWnd&, sTitel As String) As Long
Dim Parent&, Task&, Result&, X&, Style&, Title$
'Darstellung des Fensters
Style = GetWindowLong(hWnd, GWL_STYLE)
Result = GetWindowTextLength(hWnd) + 1
Title = Space$(Result)
Result = GetWindowText(hWnd, Title, Result)
Title = Left$(Title, Len(Title) - 1)
If Title Like "*" & sTitel & "*" Then
GetWindowInfo = hWnd
Exit Function
End If
End Function
'diese Sub minimiert den Internet Explorer
Sub Minimize_Internet_Explorer()
Dim hWnd As Long, tbuf As String, RetVal As Long
Const Nur_Sichtbare As Boolean = True
hWnd = GetDesktopWindow()
hWnd = GetWindow(hWnd, GW_CHILD)
GetWindowInfo hWnd, "Internet Explorer"
Do While hWnd <> 0
tbuf = String(255, 0)
RetVal = GetWindowText(hWnd, tbuf, Len(tbuf))
hWnd = GetWindow(hWnd, GW_HWNDNEXT)
If GetWindowInfo(hWnd, "Internet Explorer") = hWnd Then
ShowWindow hWnd, iMinimized
End If
Loop
End Sub