Code: Alles auswählen
EnableExplicit
Global window,liste,event
Procedure.s GetClassName(hwnd)
Protected *temp,temp.s
*temp=AllocateMemory(1024)
If GetClassName_(hwnd, *temp, 1024)=0
temp=Space(1024)
GetClassName_(hwnd, temp, 1024)
Else
temp=PeekS(*temp)
EndIf
FreeMemory(*temp)
ProcedureReturn temp
EndProcedure
Procedure EnumProc(hwnd)
Protected title.s{1024},class.s{1024}
GetWindowText_(hwnd,@title,1024)
class=GetClassName(hwnd)
AddGadgetItem(liste,-1,title+Chr(10)+class+Chr(10)+Str(hwnd))
ProcedureReturn #True
EndProcedure
Procedure EnumChildren(hWnd.i)
Protected nexthwnd.i, szClass.s{1024}, szText.s{1024},rect.rect,size,parts,count,*temp,*temp2,process
nexthwnd = GetWindow_(hwnd, #GW_CHILD | #GW_HWNDFIRST)
While nexthwnd <> 0
szClass=GetClassName(nexthwnd)
size=SendMessage_(nexthwnd,#WM_GETTEXTLENGTH,0,0)
;GetWindowText_(nexthwnd, @szText, SizeOf(szText))
;SendMessage_(nexthwnd, #WM_GETTEXT, SizeOf(szText), @szText)
SendMessage_(nexthwnd, #WM_GETTEXT, size+1, @szText)
GetWindowRect_(nexthwnd,rect)
PrintN("Enabled="+Str(IsWindowEnabled_(nexthwnd))+" ID="+Str(GetDlgCtrlID_(nexthwnd))+" Rect="+Str(rect\left)+","+Str(rect\top)+","+Str(rect\right)+","+Str(rect\bottom)+" Class=" + szClass + " Length="+Str(SendMessage_(nexthwnd, #WM_GETTEXTLENGTH,0,0))+" Text=" + szText)
If szClass="msctls_statusbar32"
parts=SendMessage_(nexthwnd,#SB_GETPARTS,0,0)
PrintN("Parts: "+Str(parts))
For count=0 To parts-1
size=SendMessage_(nexthwnd,#SB_GETTEXTLENGTH,count,0)
PrintN("Size: "+Str(size))
;szText=Space(size)
process=OpenProcess_(#PROCESS_ALL_ACCESS,#False,GetCurrentProcessId_())
*temp=VirtualAllocEx_(process, #Null, 512,#MEM_COMMIT, #PAGE_READWRITE)
PrintN("Result: "+Str(SendMessage_(nexthwnd,#SB_GETTEXT,count,*temp)))
*temp2=AllocateMemory(512)
ReadProcessMemory_(process,*temp,*temp2,512,#Null)
PrintN(Str(count)+": "+PeekS(*temp))
PrintN(Str(count)+": "+PeekS(*temp2))
VirtualFreeEx_(process,*temp,0,#MEM_RELEASE)
FreeMemory(*temp2)
Next
EndIf
EnumChildren(nexthwnd)
nexthwnd = GetWindow_(nexthwnd, #GW_HWNDNEXT)
Wend
EndProcedure
OpenConsole()
ExamineDesktops()
window=OpenWindow(#PB_Any,#PB_Ignore,#PB_Ignore,700,800,"Window-Enumerator",#PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)
liste=ListIconGadget(#PB_Any,0,0,700,800,"Window",300,#PB_ListIcon_AlwaysShowSelection | #PB_ListIcon_FullRowSelect | #PB_ListIcon_GridLines)
AddGadgetColumn(liste,1,"Class",300)
AddGadgetColumn(liste,2,"Handle",80)
AddKeyboardShortcut(window,#PB_Shortcut_F5,1000)
EnumWindows_(@EnumProc(),0)
Repeat
event=WaitWindowEvent()
If EventMenu()=1000
ClearGadgetItems(liste)
EnumWindows_(@EnumProc(),0)
ElseIf EventType()=#PB_EventType_LeftDoubleClick And EventGadget()=liste
If GetGadgetState(liste)<>-1
ClearConsole()
PrintN("Start")
;BringWindowToTop_(Val(GetGadgetItemText(liste,GetGadgetState(liste),2)))
EnumChildren(Val(GetGadgetItemText(liste,GetGadgetState(liste),2)))
PrintN("Ende")
EndIf
EndIf
Until event=#PB_Event_CloseWindow
RemoveKeyboardShortcut(window,#PB_Shortcut_F5)
CloseWindow(window)
End
Doppelklick auf ein Element zeigt die Subelemente an. Vielleicht findest du da deinen Text. Das Ganze ist absolut verbesserungwürdig und nur mal aus der Not heraus entstanden. Bin für alle Verbesserungen offen.