Code: Alles auswählen
;Originalcode von Kiffi
;modifiziert am 05.10.2007 von Tafkadasom2k5
;Kein Compiler zur Hand, von daher bitte überprüfen ;)
;Flags, die unter Umständen beim GetWindowPlacement herauskommen könnten
#SW_HIDE = 0
#SW_SHOWNORMAL = 1
#SW_NORMAL = 1
#SW_SHOWMINIMIZED = 2
#SW_SHOWMAXIMIZED = 3
#SW_MAXIMIZE = 3
#SW_SHOWNOACTIVATE = 4
#SW_SHOW = 5
#SW_MINIMIZE = 6
#SW_SHOWMINNOACTIVE = 7
#SW_SHOWNA = 8
#SW_RESTORE = 9
#SW_SHOWDEFAULT = 10
#SW_FORCEMINIMIZE = 11
CompilerIf Defined(SW_MAX, #PB_Constant) = 0
#SW_MAX = 11
CompilerEndIf
;Zusätzliche Strukturen, sofern noch nicht definiert
CompilerIf Defined(RECT, #PB_Structure) = 0
Structure RECT
left.l
top.l
right.l
bottom.l
EndStructure
CompilerEndIf
CompilerIf Defined(POINT, #PB_Structure) = 0
Structure POINT
x.l
y.l
EndStructure
CompilerEndIf
CompilerIf Defined(WINDOWPLACEMENT, #PB_Structure) = 0
Structure WINDOWPLACEMENT
length.l
flags.l
showCmd.l
ptMinPosition.point
ptMaxPosition.point
rcNormalPosition.rect
EndStructure
CompilerEndIf
Structure Window
Childs.l
Rekursion.l
;Window
Handle.l
Process.l
Name.s
Class.s
WinAttributes.WINDOWPLACEMENT ;Bauen wir noch zusätzlich rein.
EndStructure
#BufferSize = 2048
Global NewList Window.Window()
Procedure.s GetClassName(Handle.l)
Class.s = Space(#BufferSize)
GetClassName_(Handle, @Class, Len(Class))
ProcedureReturn Left(Class, Len(Class))
EndProcedure
Procedure.s GetTitle(Handle)
Name.s = Space(#BufferSize)
GetWindowText_(Handle, @Name, Len(Name))
ProcedureReturn Left(Name, Len(Name))
EndProcedure
;Hinzugefügte Prozedur zum Ermitteln, ob Fenster existent. Notfalls mal mt den Flags herumprobieren.
Procedure IsVisibleWindow(*myWindow.Window)
showCommand.l = *myWindow\WinAttributes\showCmd
If showCommand <> #SW_HIDE And showCommand = #SW_SHOWMAXIMIZED Or showCommand = #SW_MAXIMIZE Or showCommand = #SW_SHOWMINIMIZED Or showCommand = #SW_MINIMIZE
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
Procedure EnumProc(Handle.l, lParam.l)
AddElement(Window())
Window()\Handle = Handle
Window()\Process = 0
GetWindowThreadProcessId_(Handle, @Window()\Process)
Window()\Name = GetTitle(Handle)
Window()\Class = GetClassName(Handle)
;Windowattribute zusätzlich hinzufügen
Window()\WinAttributes\length = SizeOf(WINDOWPLACEMENT)
GetWindowPlacement_(Handle, @Window()\WinAttributes)
If lParam
*tmp.Window = lParam
*tmp\Childs + 1
Window()\Rekursion = *tmp\Rekursion + 1
Else
Window()\Rekursion = 0
EndIf
; EnumChildWindows_(Handle, @EnumProc(), @Window())
ProcedureReturn #True
EndProcedure
Procedure EnumAllWindows()
Protected TmpL.l
ClearList(Window())
TmpL = EnumWindows_(@EnumProc(), 0)
EndProcedure
;-
lCounter.l
EnumAllWindows()
ForEach Window()
If IsVisibleWindow(Window())
Debug "--------------"
Debug Window()\Handle
Debug Window()\Name
Debug Window()\Class
Debug "--------------"
EndIf
Next
Wie macht dieses ALT+TAB Fenster das?
Kann man eventuell auch das abfragen?
[/edit]
Gruß
Scarabol