Ich hab da mal vor langer Zeit was geschrieben, vielleicht könnt ihr ja was damit anfangen:
Code: Alles auswählen
;/
;/WindowsXP Topper
;/Sucht nach allen verfügbaren Fenstern, und bietet die Möglichkeit, sie zu toppen!
;/(C) 2005 by Leo (http://www.leoxikon.de)
;/
Enumeration ;Windows
#Window_Main
EndEnumeration
Enumeration ;Gadgets
#Gadget_ComboBox_Windows
#Gadget_Text_Info
#Gadget_CheckBox_Forerground
#Gadget_Button_Reload
#Gadget_Button_Close
#Gadget_Button_Minimize
#Gadget_Button_Maximize
#Gadget_Button_Hide
#Gadget_CheckBox_Hide
EndEnumeration
Structure Window
Name.s
Class.s
hWnd.l
EndStructure
Structure WINDOWINFO
cbsize.l
rcWindow.RECT
rcClient.RECT
dwStyle.l
dwExStyle.l
dwWindowStatus.l
cxWindowBorders.l
cyWindowBorders.l
AtomWindowType.l
wCreatorVersion.w
EndStructure
NewList Window.Window()
Global Quit
Procedure.s GetWindowClass(hwnd)
Buffer.s = Space(1000)
GetClassName_(hWnd,@Buffer,1000)
ProcedureReturn Buffer
EndProcedure
Procedure.s GetWindowName(hwnd)
Buffer.s = Space(1000)
GetWindowText_(hWnd,@Buffer,1000)
ProcedureReturn Buffer
EndProcedure
Procedure EnumWindowsProc(hWnd,lParam)
Name.s = GetWindowName(hWnd)
Class.s = GetWindowClass(hWnd)
Do.l = 1
If GetWindowLong_(hWnd,#GWL_STYLE) & #WS_CHILD = #WS_CHILD Or GetWindowLong_(hWnd,#GWL_STYLE) & #WS_CAPTION <> #WS_CAPTION Or Trim(Name) = "" Or GetWindowLong_(hWnd,#GWL_STYLE) & #WS_POPUP = #WS_POPUP
Do = 0
EndIf
If Do = 1
AddGadgetItem(#Gadget_ComboBox_Windows,-1,name)
AddElement(Window())
Window()\name = name
Window()\Class = Class
Window()\hWnd = hWnd
EndIf
If hWnd
ProcedureReturn 1
Else
ProcedureReturn 0
EndIf
EndProcedure
Procedure GetWindows()
ClearGadgetItemList(#Gadget_ComboBox_Windows)
ClearList(Window())
EnumDesktopWindows_(GetThreadDesktop_(GetCurrentThreadId_()),@EnumWindowsProc(),0)
SetGadgetState(#Gadget_ComboBox_Windows,0)
EndProcedure
Procedure OpenWindow_Main()
If OpenWindow(#Window_Main,0,0,620,200,#PB_Window_ScreenCentered|#PB_Window_SystemMenu,"WindowsXP Topper - (C) 2005 by Leo (http://www.leoxikon.de)")
If CreateGadgetList(WindowID())
hComboBox = ComboBoxGadget(#Gadget_ComboBox_Windows,10,10,300,300)
Frame3DGadget(#PB_Any,10,40,300,145,"Info")
TextGadget(#Gadget_Text_Info,20,60,250,50,"")
CheckBoxGadget(#Gadget_CheckBox_Forerground,20,110,200,20,"Immer in den Vordergrund setzen")
CheckBoxGadget(#Gadget_CheckBox_Hide,20,130,200,20,"Verstecken")
Frame3DGadget(#PB_Any,320,5,290,180,"Controls")
ButtonGadget(#Gadget_Button_Reload,330,20,130,25,"Liste neuladen")
ButtonGadget(#Gadget_Button_Close,470,20,130,25,"Schließen")
ButtonGadget(#Gadget_Button_Minimize,330,55,130,25,"Minimieren")
ButtonGadget(#Gadget_Button_Maximize,470,55,130,25,"Maximieren")
EndIf
EndIf
SetFocus_(hComboBox)
EndProcedure
Procedure IsWindowTopMost(hWnd)
TmpWInfo.WINDOWINFO
TmpWInfo\cbsize = SizeOf(WINDOWINFO)
GetWindowInfo_(hWnd,@TmpWInfo)
If TmpWInfo\dwExStyle & #WS_EX_TOPMOST
ProcedureReturn 1
Else
ProcedureReturn 0
EndIf
EndProcedure
Procedure UpdateInfo()
tString.s = ""
If GetGadgetState(#Gadget_ComboBox_Windows) <> -1
SelectElement(Window(),GetGadgetState(#Gadget_ComboBox_Windows))
tString.s = "Name: "+Window()\Name
tString.s + Chr(10)+Chr(13)
tString.s + "Klasse: "+Window()\Class
tString.s + Chr(10)+Chr(13)
tString.s + "Handle: "+Str(Window()\hWnd)
Else
tString.s = "Sie haben keinen Eintrag ausgewählt."
EndIf
SetGadgetText(#Gadget_Text_Info,tString)
SetGadgetState(#Gadget_CheckBox_Forerground,IsWindowTopMost(Window()\hWnd))
SetGadgetState(#Gadget_CheckBox_Hide,IsWindowVisible_(Window()\hWnd)!1)
EndProcedure
Procedure SetWindowToTop(hWnd,State)
If state = 1
flag = #HWND_TOPMOST
Else
flag = #HWND_NOTOPMOST
EndIf
SetWindowPos_(hWnd,flag,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
UpdateInfo()
EndProcedure
Procedure ChShowWindow(hWnd,State)
If state = 1
flag = #SW_SHOW
Else
flag = #SW_HIDE
EndIf
ShowWindow_(hWnd,flag)
EndProcedure
Procedure DoEvent(Event)
Select Event
Case #PB_Event_CloseWindow
Quit = #True
Case #PB_Event_Gadget
If GetGadgetState(#Gadget_ComboBox_Windows) <> -1
SelectElement(Window(),GetGadgetState(#Gadget_ComboBox_Windows))
EndIf
Select EventGadgetID()
Case #Gadget_ComboBox_Windows
UpdateInfo()
Case #Gadget_CheckBox_Forerground
SetWindowToTop(Window()\hWnd,GetGadgetState(#Gadget_CheckBox_Forerground))
Case #Gadget_Button_Reload
GetWindows()
UpdateInfo()
Case #Gadget_Button_Close
PostMessage_(Window()\hWnd,#WM_CLOSE,0,0)
GetWindows()
UpdateInfo()
Case #Gadget_Button_Minimize
CloseWindow_(Window()\hWnd)
Case #Gadget_Button_Maximize
ShowWindow_(Window()\hWnd,#SW_SHOWMAXIMIZED)
Case #Gadget_CheckBox_Hide
ShowWindow_(Window()\hWnd,GetGadgetState(#Gadget_CheckBox_Hide)!1)
EndSelect
EndSelect
EndProcedure
OpenWindow_Main()
GetWindows()
UpdateInfo()
Repeat
DoEvent(WaitWindowEvent())
Until Quit = #True
End