Seite 1 von 1

Alle Prozesse in einer Liste speichern

Verfasst: 06.09.2011 19:41
von Sunny
Hallo,
Ich habe mal wieder ein kleines Problem...
ich habe auf rsbasic.de mal ein Code-Snippet gefunden, mit dem man sich alle Prozesse anzeigen lassen kann. Hier mal der Code:

Code: Alles auswählen

Procedure ListWindows(hwnd,Param)
  If GetWindowLongPtr_(hwnd,#GWL_EXSTYLE) ! #WS_EX_TOOLWINDOW And GetWindowLongPtr_(hwnd,#GWL_STYLE)
   String$ = Space(250)
   GetWindowText_(hwnd,String$,250)
   If Not String$=""
     AddGadgetItem(1,-1,String$,0,0)
   EndIf
  EndIf
  ProcedureReturn #True
EndProcedure

If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
  ListViewGadget(1,10,10,480,230,0)
  
  EnumChildWindows_(FindWindow_("ToolbarWindow32",#Null),@ListWindows(),0)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Jetzt wollte ich mal wissen, ob es irgendwie möglich ist, sich das ganze mittels "NewList" in einer Liste zu speichern, ohne alles erst in einem fenster anzeigen lassen zu müssen.

Re: Alle Prozesse in einer Liste speichern

Verfasst: 06.09.2011 19:59
von ts-soft

Code: Alles auswählen

Global NewList Fenster.s()

Procedure ListWindows(hwnd,Param)
  If GetWindowLongPtr_(hwnd,#GWL_EXSTYLE) ! #WS_EX_TOOLWINDOW And GetWindowLongPtr_(hwnd,#GWL_STYLE)
   String$ = Space(250)
   GetWindowText_(hwnd,String$,250)
   If Not String$=""
    AddElement(Fenster())
    Fenster() = String$
   EndIf
  EndIf
  ProcedureReturn #True
EndProcedure

If OpenWindow(0,0,0,500,250,"Window",#PB_Window_SystemMenu|#PB_Window_Invisible)
  EnumChildWindows_(FindWindow_("ToolbarWindow32",#Null),@ListWindows(),0)
EndIf 

ForEach Fenster()
  Debug Fenster()
Next