beispiel aus alten BoardArchiv von GPI

Windowsspezifisches Forum , API ,..
Beiträge, die plattformübergreifend sind, gehören ins 'Allgemein'-Forum.
bossi
Beiträge: 12
Registriert: 07.10.2004 19:40

beispiel aus alten BoardArchiv von GPI

Beitrag von bossi »

hi,
nun ist alle anders :freak: naja.
also ich habe mal im alten board rumgeschaut und bin auf diese sache gestossen von GPI.

Code: Alles auswählen

;-ini 
Structure info 
  handle.l 
  process.l 
  class$ 
  name$ 
EndStructure 
#PROCESS_ALL_ACCESS=$FFF 

NewList info.info() 
NewList AllHandle() 

Procedure.s GetClassName(handle) 
  class$=Space(1024) 
  GetClassName_(handle,@class$,Len(class$)) 
  ProcedureReturn Left(class$,Len(class$)) 
EndProcedure 
Procedure.s GetTitle(handle) 
  name$=Space(1024) 
  GetWindowText_(handle,@name$,Len(name$)) 
  ProcedureReturn Left(name$,Len(name$)) 
EndProcedure 
Procedure AddInfo(Handle) 
  process=0 
  GetWindowThreadProcessId_(handle,@process) 
  Class$=GetClassName(handle) 
  Name$=GetTitle(handle) 
  
  ResetList(info()) 
  quit=0 
  i=0 
  Repeat 
    If NextElement(info()) 
      If process < info()\process 
        quit=1 
      ElseIf process=info()\process 
        If class$ < info()\class$ 
          quit=1 
        ElseIf UCase(class$)=UCase(info()\class$) 
          If name$ < info()\name$ 
            quit=1 
          ElseIf UCase(name$)=UCase(info()\name$) 
            If handle < info()\handle 
              quit=1 
            ElseIf handle=info()\handle 
              quit=3 
            EndIf 
          EndIf 
        EndIf 
      EndIf 
    Else 
      quit=2 
    EndIf 
  Until quit 
  If quit<3 
    If quit=1 
      If PreviousElement(info())=0: ResetList(info()) :EndIf 
    EndIf 
    AddElement(info()) 
    info()\handle=handle 
    info()\process=process 
    info()\class$=class$ 
    info()\name$=name$ 
  EndIf 
EndProcedure 
Procedure TerminateProcess(processid) 
  process=OpenProcess_(#PROCESS_ALL_ACCESS,1,processid) 
  If process 
    terminateprocess_(process,0) 
    closehandle_(process) 
  EndIf 
EndProcedure 
Procedure RefreshList() 
  ClearGadgetItemList(0) 

  ClearList(allhandle()) 
  ClearList(info()) 
  handle=getwindow_(WindowID(),#GW_HWNDFIRST) 
  ClearList(allhandle()) 
  quit=0 
  Repeat 
    AddInfo(handle) 
    x=getwindow_(handle,#GW_CHILD) 
    If x 
      AddElement(allhandle()) 
      allhandle()=x 
    EndIf 
    x=getwindow_(handle,#GW_HWNDNEXT) 
    If x 
      handle=x 
    Else 
      If LastElement(allhandle()) 
        handle=allhandle() 
        DeleteElement(allhandle()) 
      Else 
        quit=1 
      EndIf 
    EndIf 
  Until quit 
  
  ResetList(info()) 
  
    
  While NextElement(info()) 
    If oldprocess<>info()\process 
      oldprocess=info()\process 
      a$=Hex(oldprocess) 
    Else 
      a$="              ''" 
    EndIf 
    AddGadgetItem(0,-1,a$+Chr(10)+info()\class$+Chr(10)+info()\name$+Chr(10)+Hex(info()\handle)) 

  Wend 
  
  SetGadgetState(0,0) 
EndProcedure 

If OpenWindow(0,0,400,512,320,#PB_Window_SystemMenu,"Tasks") 
  

  If CreateGadgetList(WindowID()) 
    ListIconGadget(0, 0,0,512,300, "Process",60) 
    AddGadgetColumn(0,1,"Class",220) 
    AddGadgetColumn(0,2,"Name",150) 
    AddGadgetColumn(0,3,"Handle",50) 
    ButtonGadget(1,   0,300, 128,20,"Send Quit") 
    ButtonGadget(2, 128,300, 128,20,"Send Close") 
    ButtonGadget(3, 256,300, 128,20,"Terminate Process") 
    ButtonGadget(4, 384,300, 128,20,"Refresh List") 
    
    RefreshList() 
    
    Repeat 
      event=WaitWindowEvent() 
      Select event 
        Case #pb_event_gadget 
          stat=GetGadgetState(0) 
          If stat>-1 
            SelectElement(info(),stat) 
            stat=1 
          Else 
            stat=0 
          EndIf 

          Select EventGadgetID() 
;             Case 0: 
;               If stat 
;                 Debug Hex(info()\process)+" | "+info()\class$+" | "+info()\name$+" | "+Hex(info()\handle) 
;               EndIf 
             Case 1;quit 
               If stat: postmessage_(info()\handle,#wm_quit,0,0):EndIf 
             Case 2;close 
               If stat: postmessage_(info()\handle,#wm_close,0,0):EndIf 
             Case 3;Terminate 
               If stat: TerminateProcess(info()\process) :EndIf 
             Case 4 
               RefreshList() 
          EndSelect 
      EndSelect 
          
    Until event=#pb_event_Closewindow 
  EndIf 
EndIf
es wir der festertitel schon angegeben von operabrowser :)
und der hammer ist, da ein framefenster geteilt wird (jedes farmeset hat eine eigene ID)
wie stellt man es nun an den quellcode dieser frames zu lesen ?
habe nicht so nen plan von API´s :oops:
habe es mal mit wm_gettext und so versucht, aber ohne erfolg :roll:
weis einer der profis hier mal rat.

bye
bossi
Benutzeravatar
NicTheQuick
Ein Admin
Beiträge: 8808
Registriert: 29.08.2004 20:20
Computerausstattung: Ryzen 7 5800X, 64 GB DDR4-3200
Ubuntu 24.04.2 LTS
GeForce RTX 3080 Ti
Wohnort: Saarbrücken

Beitrag von NicTheQuick »

Was meinst du mit Quellcode von einem einzelnen Frame?
Ansonsten schau dir mal mein EnumAllWindows noch an. Damit kannst du etwas komfortabler zwischen den einzelnen Prozessen und Fenstern browsen.
bossi
Beiträge: 12
Registriert: 07.10.2004 19:40

Beitrag von bossi »

hi nic,
ich meine wen ich eine seite mit frame in mein opera aufschlage, sind in der liste von GPI für diese 1ne 2 handling vorhaden.
nun möchte ich z.b. von hadling 1 denn stringinhalt haben d.h. quellcode der seite.
ein webgatget ist doch glaube ich ein richedit oder ?
dann müßte es doch möglich sein den inhalt herraus zu bekommen.
bin mal dein link gefolgt, nach compelierung von "EnumAllWindows"
fehlet line 592 : ClosePanelGadget()
habe ich ausgeklammer und dann kommt schon wieder eine fehlermeldung.
Repeat
If Width <> WindowWidth() Or Height <> WindowHeight()
Width = WindowWidth()
Height = WindowHeight()
ResizeGadget(0, -1, -1, Width - #T1Width - 5, Height - #PanelHeight - 5)
ResizeGadget(2, -1, -1, Width - #T1Width - 52, -1)
ResizeGadget(3, Width - #T1Width - 50, -1, -1, -1)
ResizeGadget(4, -1, -1, Width - #T1Width - 10, -1)
ResizeGadget(5, -1, Height - #PanelHeight, Width - #T1Width - 5, -1)
For a.l = 10 To 26
fehler line 625 : If GadgetID(a)

und was soll ich nun machen ? benutze pure 3.91

mfg
bossi
Benutzeravatar
NicTheQuick
Ein Admin
Beiträge: 8808
Registriert: 29.08.2004 20:20
Computerausstattung: Ryzen 7 5800X, 64 GB DDR4-3200
Ubuntu 24.04.2 LTS
GeForce RTX 3080 Ti
Wohnort: Saarbrücken

Beitrag von NicTheQuick »

Oh, Mist. Tut mir Leid. Hatte ganz vergessen, dass der Code so alt ist. :wink:

Hier eine neue Version:

Code: Alles auswählen

Structure Window
  Childs.l
  Rekursion.l
  
  ;Window
  handle.l
  process.l
  Name.s
  Class.s
EndStructure

#BufferSize = 2048

Global LF.s
LF = Chr(13) + Chr(10)

Declare RefreshList(modus.l)
Declare AddWindow(*Tmp.Window)
Declare EnumAllWindows()
Declare EnumAllSubChilds(handle.l, lParam.l)
Declare EnumProc(handle.l, lParam.l)
Declare.s GetTitle(handle) 
Declare.s GetClassName(handle.l)

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

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)
  
  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

;-

Procedure AddWindow(*Tmp.Window)
  handle.l = *Tmp\handle
  ClassName.s = *Tmp\Class
  processid.l = *Tmp\process
  Name.s = *Tmp\Name
  Childs.l = *Tmp\Childs
  ;AddGadgetItem(0, -1, "Handle: " + Str(Handle) + ", Process ID: " + Str(ProcessID) + ", Name: " + Chr(34) + Name + Chr(34) + ", Class Name: " + Chr(34) + ClassName + Chr(34))
  AddGadgetItem(0, -1, Name + " (" + ClassName + ") [" + Right("0000000" + Hex(handle), 8) + ", " + Right("0000000" + Hex(processid), 8) + "] + <" + Str(Childs) + ">")
EndProcedure

Procedure AddNodeToList()
  AddWindow(@Window())
  If Window()\Childs
    OpenTreeGadgetNode(0)
    Childs = Window()\Childs
    For a.l = 1 To Childs
      NextElement(Window())
      AddNodeToList()
    Next
    CloseTreeGadgetNode(0)
  EndIf
EndProcedure

Procedure RefreshList(modus.l)
  If modus & 1
    SetWindowCallback(0)
    ClearGadgetItemList(0)
    ResetList(Window())
    While NextElement(Window())
      AddNodeToList()
    Wend
    While WindowEvent() : Wend
  EndIf
  
  If modus & 2
    State.l = GetGadgetState(0)
    ResetList(Window())
    c.l = 0
    While NextElement(Window())
      If Window()\Childs > 0
        SetGadgetItemState(0, c, #PB_Tree_Expanded)
      EndIf
      c + 1
    Wend
    SetGadgetState(0, State)
  EndIf
  
  If modus & 8
    State.l = GetGadgetState(0)
    If State >= 0
      SelectElement(Window(), State)
      Rek.l = Window()\Rekursion
      c.l = State
      Repeat
        If Window()\Childs > 0
          SetGadgetItemState(0, c, #PB_Tree_Expanded)
        EndIf
        c + 1
      Until NextElement(Window()) = 0 Or (Window()\Rekursion = Rek And c > State)
      SetGadgetState(0, State)
    EndIf
  EndIf

EndProcedure

Procedure DelProcInList(process.l)
  ResetList(Window())
  While NextElement(Window())
    If Window()\process = process
      DeleteElement(Window())
    EndIf
  Wend
EndProcedure

Procedure.s rgState(DWord.l)
  #STATE_SYSTEM_FOCUSABLE = $00100000
  #STATE_SYSTEM_INVISIBLE = $8000
  #STATE_SYSTEM_OFFSCREEN = $10000
  #STATE_SYSTEM_UNAVAILABLE = $1
  #STATE_SYSTEM_PRESSED = $08
  
  Text.s = ""
  If DWord & #STATE_SYSTEM_FOCUSABLE
    Text = Text + "can accept the focus, "
  EndIf
  If DWord & #STATE_SYSTEM_INVISIBLE
    Text = Text + "invisible, "
  EndIf
  If DWord & #STATE_SYSTEM_OFFSCREEN
    Text = Text + "no visible representation, "
  EndIf
  If DWord & #STATE_SYSTEM_UNAVAILABLE
    Text = Text + "unavailable, "
  EndIf
  If DWord & #STATE_SYSTEM_PRESSED
    Text = Text + "pressed, "
  EndIf
  
  If Text
    Text = Left(Text, Len(Text) - 2)
  Else
    Text = "n/a"
  EndIf
  ProcedureReturn Text
EndProcedure

Procedure.s dwStyle(DWord.l)
  Text.s = ""
  If DWord & #WS_BORDER
    Text = Text + "thin-line border, "
  EndIf
  If DWord & #WS_CAPTION
    Text = Text + "title bar, "
  EndIf
  If DWord & #WS_CHILD
    Text = Text + "child, "
  EndIf
  If DWord & #WS_CHILDWINDOW
    Text = Text + "child, "
  EndIf
  If DWord & #WS_CLIPCHILDREN
    Text = Text + "#WS_CLIPCHILDREN, "
  EndIf
  If DWord & #WS_CLIPSIBLINGS
    Text = Text + "#WS_CLIPSIBLINGS, "
  EndIf
  If DWord & #WS_DISABLED
    Text = Text + "disabled, "
  EndIf
  If DWord & #WS_DLGFRAME
    Text = Text + "#WS_DLGFRAME, "
  EndIf
  If DWord & #WS_GROUP
    Text = Text + "first group control, "
  EndIf
  If DWord & #WS_HSCROLL
    Text = Text + "horizontal scroll bar, "
  EndIf
  If DWord & #WS_ICONIC
    Text = Text + "minimized, "
  EndIf
  If DWord & #WS_MAXIMIZE
    Text = Text + "maximized, "
  EndIf
  If DWord & #WS_MAXIMIZEBOX
    Text = Text + "maximize button, "
  EndIf
  If DWord & #WS_OVERLAPPED
    Text = Text + "overlapped, "
  EndIf
  If DWord & #WS_OVERLAPPEDWINDOW
    Text = Text + "overlapped, "
  EndIf
  If DWord & #WS_POPUP
    Text = Text + "pop-up, "
  EndIf
  If DWord & #WS_POPUPWINDOW
    Text = Text + "pop-up, "
  EndIf
  If DWord & #WS_SIZEBOX
    Text = Text + "sizing border, "
  EndIf
  If DWord & #WS_SYSMENU
    Text = Text + "system menu, "
  EndIf
  If DWord & #WS_TABSTOP
    Text = Text + "TAB navigation, "
  EndIf
  If DWord & #WS_THICKFRAME
    Text = Text + "sizing border, "
  EndIf
  If DWord & #WS_TILED
    Text = Text + "overlapped, "
  EndIf
  If DWord & #WS_TILEDWINDOW
    Text = Text + "overlapped, "
  EndIf
  If DWord & #WS_VISIBLE
    Text = Text + "visible, "
  EndIf
  If DWord & #WS_VSCROLL
    Text = Text + "vertical scroll bar, "
  EndIf
  
  If Text
    Text = Left(Text, Len(Text) - 2)
  Else
    Text = "n/a"
  EndIf
  ProcedureReturn Text
EndProcedure

Procedure.s dwExStyle(DWord.l)
  #WS_EX_COMPOSITED = $02000000
  #WS_EX_LAYERED = $80000
  #WS_EX_LAYOUTRTL = $400000
  #WS_EX_NOACTIVATE = $8000000
  #WS_EX_NOINHERITLAYOUT = $100000
  
  Text.s = ""
  If DWord & #WS_EX_ACCEPTFILES
    Text = Text + "accept drag-drop files, "
  EndIf
  If DWord & #WS_EX_APPWINDOW
    Text = Text + "taskbar window, "
  EndIf
  If DWord & #WS_EX_CLIENTEDGE
    Text = Text + "sunken edge border, "
  EndIf
  If DWord & #WS_EX_COMPOSITED
    Text = Text + "#WS_EX_COMPOSITED, "
  EndIf
  If DWord & #WS_EX_CONTEXTHELP
    Text = Text + "question mark button, "
  EndIf
  If DWord & #WS_EX_CONTROLPARENT
    Text = Text + "#WS_EX_CONTROLPARENT, "
  EndIf
  If DWord & #WS_EX_DLGMODALFRAME
    Text = Text + "double border, "
  EndIf
  If DWord & #WS_EX_LAYERED
    Text = Text + "layred, "
  EndIf
  If DWord & #WS_EX_LAYOUTRTL
    Text = Text + "Arabic/Hebrew, "
  EndIf
  If DWord & #WS_EX_LEFT
    Text = Text + "left-aligned, "
  EndIf
  If DWord & #WS_EX_LEFTSCROLLBAR
    Text = Text + "left scroll bar, "
  EndIf
  If DWord & #WS_EX_LTRREADING
    Text = Text + "left-to-right reading, "
  EndIf
  If DWord & #WS_EX_MDICHILD
    Text = Text + "MDI child, "
  EndIf
  If DWord & #WS_EX_NOACTIVATE
    Text = Text + "#WS_EX_NOACTIVATE, "
  EndIf
  If DWord & #WS_EX_NOINHERITLAYOUT
    Text = Text + "#WS_EX_NOINHERITLAYOUT, "
  EndIf
  If DWord & #WS_EX_NOPARENTNOTIFY
    Text = Text + "no #WS_PARENTNOTIFY message, "
  EndIf
  If DWord & #WS_EX_OVERLAPPEDWINDOW
    Text = Text + ""
  EndIf
  If DWord & #WS_EX_PALETTEWINDOW
    Text = Text + ""
  EndIf
  If DWord & #WS_EX_RIGHT
    Text = Text + "right-aligned, "
  EndIf
  If DWord & #WS_EX_RIGHTSCROLLBAR
    Text = Text + "right scroll bar, "
  EndIf
  If DWord & #WS_EX_RTLREADING
    Text = Text + "right-to-left reading, "
  EndIf
  If DWord & #WS_EX_STATICEDGE
    Text = Text + "3D border, "
  EndIf
  If DWord & #WS_EX_TOOLWINDOW
    Text = Text + "tool window, "
  EndIf
  If DWord & #WS_EX_TOPMOST
    Text = Text + "topmost, "
  EndIf
  If DWord & #WS_EX_TRANSPARENT
    Text = Text + "transparent, "
  EndIf
  If DWord & #WS_EX_WINDOWEDGE
    Text = Text + "raised edge, "
  EndIf
  
  If Text
    Text = Left(Text, Len(Text) - 2)
  Else
    Text = "n/a"
  EndIf
  ProcedureReturn Text
EndProcedure

Procedure.s Placement_flags(DWord.l)
  #WPF_ASYNCWINDOWPLACEMENT = $4
  #WPF_RESTORETOMAXIMIZED = $2
  #WPF_SETMINPOSITION = $1
  
  Text.s = ""
  If DWord & #WPF_ASYNCWINDOWPLACEMENT
    Text = Text + "#WPF_ASYNCWINDOWPLACEMENT, "
  EndIf
  If DWord & #WPF_RESTORETOMAXIMIZED
    Text = Text + "#WPF_RESTORETOMAXIMIZED, "
  EndIf
  If DWord & #WPF_SETMINPOSITION
    Text = Text + "#WPF_SETMINPOSITION, "
  EndIf
  
  If Text
    Text = Left(Text, Len(Text) - 2)
  Else
    Text = "n/a"
  EndIf
  ProcedureReturn Text
EndProcedure

Procedure.s Placement_showCmd(DWord.l)
  Text.s = ""
  If DWord & #SW_HIDE
    Text = Text + "hide, "
  EndIf
  If DWord & #SW_MAXIMIZE
    Text = Text + "maximize, "
  EndIf
  If DWord & #SW_MINIMIZE
    Text = Text + "minimize, "
  EndIf
  If DWord & #SW_RESTORE
    Text = Text + "restore, "
  EndIf
  If DWord & #SW_SHOW
    Text = Text + "show, "
  EndIf
  If DWord & #SW_SHOWMAXIMIZED
    Text = Text + "show maxmized, "
  EndIf
  If DWord & #SW_SHOWMINIMIZED
    Text = Text + "show minimized, "
  EndIf
  If DWord & #SW_SHOWMINNOACTIVE
    Text = Text + "show no active, "
  EndIf
  If DWord & #SW_SHOWNA
    Text = Text + "show (na), "
  EndIf
  If DWord & #SW_SHOWNOACTIVATE
    Text = Text + "show no activate, "
  EndIf
  If DWord & #SW_SHOWNORMAL
    Text = Text + "show normal, "
  EndIf

  If Text
    Text = Left(Text, Len(Text) - 2)
  Else
    Text = "n/a"
  EndIf
  ProcedureReturn Text
EndProcedure



Procedure.s GetWindowInfo(handle.l)
  Text.s = "Info about " + Hex(Handle) + ":" + LF + LF
  If Handle
    ;Width and height
     If GetClientRect_(Handle, @Size.RECT)
       Text = Text + "GetClientRect_:" + LF
       Text = Text + "W" + Str(Size\Right) + "x" + Str(Size\Bottom) + LF + LF
     EndIf
    
    ;GetTitleBarInfo_()
     Structure TITLEBARINFO
       cbsize.l
       rcTitleBar.RECT
       rgState.l[6]
     EndStructure
     
     TitleBar.TITLEBARINFO
     TitleBar\cbsize = SizeOf(TITLEBARINFO)
     If GetTitleBarInfo_(Handle, @TitleBar)
       Text = Text + "GetTitleBarInfo_:" + LF
       Text = Text + "Rect: L" + Str(TitleBar\rcTitleBar\Left) + ", T" + Str(TitleBar\rcTitleBar\Top)
       Text = Text + ", R" + Str(TitleBar\rcTitleBar\Right) + ", B" + Str(TitleBar\rcTitleBar\Bottom) + LF
       Text = Text + "Elements:" + LF
       Text = Text + "Title bar itself: " + rgState(TitleBar\rgState[0]) + LF
       Text = Text + "Minimize Button: " + rgState(TitleBar\rgState[2]) + LF
       Text = Text + "Maximize Button: " + rgState(TitleBar\rgState[3]) + LF
       Text = Text + "Help Button: " + rgState(TitleBar\rgState[4]) + LF
       Text = Text + "Close Button: " + rgState(TitleBar\rgState[5]) + LF + LF
     EndIf
     
    ;GetWindowInfo_
     #WS_ACTIVECAPTION = $1
     Structure WINDOWINFO
       cbsize.l
       rcWindow.RECT
       rcClient.RECT
       dwStyle.l
       dwExStyle.l
       dwWindowStatus.l
       cxWindowBorders.l
       cyWindowBorders.l
       AtomWindowType.l
       wCreatorVersion.w
     EndStructure
     
     WindowInfo.WINDOWINFO
     WindowInfo\cbsize = SizeOf(WINDOWINFO)
     If GetWindowInfo_(Handle, @WindowInfo)
       Text = Text + "GetWindowInfo_:" + LF
       Text = Text + "Window Rect: L" + Str(WindowInfo\rcWindow\Left) + ", T" + Str(WindowInfo\rcWindow\Top)
       Text = Text + ", R" + Str(WindowInfo\rcWindow\Right) + ", B" + Str(WindowInfo\rcWindow\Bottom) + LF
       Text = Text + "Client Rect: L" + Str(WindowInfo\rcClient\Left) + ", T" + Str(WindowInfo\rcClient\Top)
       Text = Text + ", R" + Str(WindowInfo\rcClient\Right) + ", B" + Str(WindowInfo\rcClient\Bottom) + LF
       Text = Text + "Style: " + dwStyle(WindowInfo\dwStyle) + LF
       Text = Text + "Ex Style: " + dwExStyle(WindowInfo\dwExStyle) + LF
       Text = Text + "Status: "
       If WindowInfo\dwWindowStatus & #WS_ACTIVECAPTION
         Text = Text + "activated" + LF
       Else
         Text = Text + "deactivated" + LF
       EndIf
       Text = Text + "Border width: " + Str(WindowInfo\cxWindowBorders) + LF
       Text = Text + "Border height: " + Str(WindowInfo\cyWindowBorders) + LF
       Text = Text + "Windows version: " + Str(WindowInfo\wCreatorVersion) + LF + LF
     EndIf
     
    ;GetModuleFileName_
     ModuleName.s = Space(1024)
     If GetModuleFileName_(Handle, ModuleName, 1024)
       Text = Text + "GetModuleFileName_:" + LF
       Text = Text + ModuleName + LF + LF
     EndIf
     
    ;GetWindowPlacement_
     Placement.WINDOWPLACEMENT
     Placement\Length = SizeOf(WINDOWPLACEMENT)
     If GetWindowPlacement_(Handle, @Placement)
       Text = Text + "GetWindowPlacement_:" + LF
       Text = Text + "Flags: " + Placement_flags(Placement\flags) + LF
       Text = Text + "Show state: " + Placement_showCmd(Placement\showCmd) + LF
       Text = Text + "Min Position: " + Str(Placement\ptMinPosition\x) + "x" + Str(Placement\ptMinPosition\y) + LF
       Text = Text + "Max Position: " + Str(Placement\ptMaxPosition\x) + "x" + Str(Placement\ptMaxPosition\y) + LF
       Text = Text + "Normal Position: L" + Str(Placement\rcNormalPosition\Left) + ", T" + Str(Placement\rcNormalPosition\Top)
       Text = Text + ", R" + Str(Placement\rcNormalPosition\Right) + ", B" + Str(Placement\rcNormalPosition\Bottom) + LF + LF
     EndIf
     
    ;IsWindowUnicode_
     Text = Text + "IsWindowUnicode_: "
     If IsWindowUnicode_(Handle)
       Text = Text + "yes"
     Else
       Text = Text + "no"
     EndIf
     ;Text = Text + LF + LF
  Else
    Text.s = "No info available"
  EndIf
  ProcedureReturn Text
EndProcedure

;-

Procedure SetGadgetStateLI(Gadget.l, State.l)
  Protected a.l
  For a = 0 To CountGadgetItems(Gadget) - 1
    If a = State
      SetGadgetItemState(Gadget, a, #PB_ListIcon_Selected)
    Else
      SetGadgetItemState(Gadget, a, 0)
    EndIf
  Next
  SendMessage_(GadgetID(Gadget), #LVM_ENSUREVISIBLE, State, 1)
EndProcedure

Procedure SetCursorOnHandle(handle.l)
  ResetList(Window())
  While NextElement(Window())
    If Window()\Handle = Handle
      
      If Window()\Rekursion
        Rek.l = Window()\Rekursion
        While PreviousElement(Window()) And Window()\Rekursion
          If Window()\Rekursion < Rek
            SetGadgetItemState(0, ListIndex(Window()) - 1, #PB_Tree_Expanded)
            Rek = Window()\Rekursion
          EndIf
        Wend
        SetGadgetItemState(0, ListIndex(Window()) - 1, #PB_Tree_Expanded)
      EndIf
      SetGadgetState(0, ListIndex(Window()) - 1)
      ProcedureReturn #True
    EndIf
  Wend
  ProcedureReturn #False
EndProcedure

Procedure AddLog(Text.s)
  State.l = CountGadgetItems(2)
  Zeit.s = FormatDate("%hh:%ii:%ss", Date())
  AddGadgetItem(2, State, Zeit)
  SetGadgetItemText(2, State, Text, 1)
  SetGadgetStateLI(2, State)
EndProcedure

Width.l = 800
Height.l = 600

If OpenWindow(0, 0, 0, Width, Height, #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget, "AllWindows and Childs")
  If CreateGadgetList(WindowID())
    #T1Width = 140
    #TEXTHEIGHT = 16
    #ButtonHeight = 18
    #StrHeight = 200
    #Abs = 5
    #PanelHeight = 200

    TreeGadget(0, 0, 0, Width - #T1Width - 5, Height - #PanelHeight - 5, #PB_Tree_AlwaysShowSelection | #PB_Tree_NoLines)    
    
    PanelGadget(5, 0, Height - #PanelHeight, Width - #T1Width - 5, #PanelHeight)
    AddGadgetItem(5, 0, "Log")
      ListIconGadget(2, 0, 0, Width - #T1Width - 52, #PanelHeight - 25, "Zeit", 100, #PB_ListIcon_AlwaysShowSelection | #PB_ListIcon_FullRowSelect)
      AddGadgetColumn(2, 1, "Log", 1000)
      ButtonGadget(3, Width - #T1Width - 50, 0, 40, #PanelHeight - 25, "Clear")
    AddGadgetItem(5, 1, "Window Info")
      StringGadget(4, 0, 0, Width - #T1Width - 10, #PanelHeight - 25, "", #PB_String_MultiLine | #WS_VSCROLL | #WS_HSCROLL)
    CloseGadgetList()
    
    ButtonGadget(10, Width - #T1Width, 0 * #ButtonHeight + 0 * #Abs, #T1Width, #ButtonHeight, "Refresh Memory")
    ButtonGadget(11, Width - #T1Width, 1 * #ButtonHeight + 0 * #Abs, #T1Width, #ButtonHeight, "Refresh List")
    
    ButtonGadget(12, Width - #T1Width, 2 * #ButtonHeight + 1 * #Abs, #T1Width, #ButtonHeight, "Open All Nodes")
    ButtonGadget(14, Width - #T1Width, 3 * #ButtonHeight + 1 * #Abs, #T1Width, #ButtonHeight, "Open Whole Node")
    
    
    ButtonGadget(16, Width - #T1Width, 4 * #ButtonHeight + 3 * #Abs, #T1Width, #ButtonHeight, "Post Quit")
    ButtonGadget(17, Width - #T1Width, 5 * #ButtonHeight + 3 * #Abs, #T1Width, #ButtonHeight, "Post Close")
    
    ButtonGadget(18, Width - #T1Width, 6 * #ButtonHeight + 4 * #Abs, #T1Width, #ButtonHeight, "Terminate Process")
    
    ButtonGadget(20, Width - #T1Width, 7 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "CloseWindow_")
    ButtonGadget(21, Width - #T1Width, 8 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "DestroyWindow_")
    ButtonGadget(22, Width - #T1Width, 9 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "Window Info")
    ButtonGadget(23, Width - #T1Width, 10 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "GetDesktopWindow_")
    ButtonGadget(24, Width - #T1Width, 11 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "GetForegroundWindow_")
    ButtonGadget(25, Width - #T1Width, 12 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "GetNextWindow_")
    ButtonGadget(26, Width - #T1Width, 13 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "GetPrevWindow_")
;     ButtonGadget(27, Width - #T1Width, 14 * #ButtonHeight + 6 * #Abs, #T1Width, #ButtonHeight, "HideWindow_")
    
    Width - 1
    Repeat
      If Width <> WindowWidth() Or Height <> WindowHeight()
        Width = WindowWidth()
        Height = WindowHeight()
        ResizeGadget(0, -1, -1, Width - #T1Width - 5, Height - #PanelHeight - 5)
        ResizeGadget(2, -1, -1, Width - #T1Width - 52, -1)
        ResizeGadget(3, Width - #T1Width - 50, -1, -1, -1)
        ResizeGadget(4, -1, -1, Width - #T1Width - 10, -1)
        ResizeGadget(5, -1, Height - #PanelHeight, Width - #T1Width - 5, -1)
        For a.l = 10 To 26
          If GadgetID(a)
            ResizeGadget(a, Width - #T1Width, -1, -1, -1)
          EndIf
        Next
      EndIf
      
      If CountList(Window())
        DisableGadget(11, 0)
      Else
        DisableGadget(11, 1)
      EndIf
      
      If CountGadgetItems(0)
        DisableGadget(12, 0)
        DisableGadget(23, 0)
        DisableGadget(24, 0)
      Else
        DisableGadget(12, 1)
        DisableGadget(23, 1)
        DisableGadget(24, 1)
      EndIf
      
      State.l = GetGadgetState(0)
      
      If State >= 0
        SelectElement(Window(), State)
        If Window()\Childs
          DisableGadget(14, 0)
        Else
          DisableGadget(14, 1)
        EndIf
        DisableGadget(16, 0)
        DisableGadget(17, 0)
        
        Result.l = OpenProcess_(#PROCESS_ALL_ACCESS, #True, Window()\process) 
        If Result
          DisableGadget(18, 0)
          closehandle_(Result)
        Else
          DisableGadget(18, 0)        
        EndIf
        
        For a.l = 19 To 21
          If GadgetID(a) : DisableGadget(a, 0) : EndIf
        Next
        
        If IsWindow_(Window()\handle)
          DisableGadget(22, 0)
        Else
          DisableGadget(22, 1)
        EndIf
        
        DisableGadget(25, 0)
        DisableGadget(26, 0)
      Else
        For a.l = 14 To 22
          If GadgetID(a) : DisableGadget(a, 1) : EndIf
        Next
        For a.l = 25 To 26
          If GadgetID(a) : DisableGadget(a, 1) : EndIf
        Next
      EndIf
      
      If CountGadgetItems(2)
        DisableGadget(3, 0)
        DisableGadget(2, 0)
      Else
        DisableGadget(3, 1)
        DisableGadget(2, 1)
      EndIf
      
      If Trim(GetGadgetText(4)) = ""
        DisableGadget(4, 1)
      Else
        DisableGadget(4, 0)
      EndIf

      EventID.l = WaitWindowEvent()
      Select EventID
        Case #PB_EventCloseWindow
          End
        
        Case #PB_EventGadget
          Select EventGadgetID()
            Case 3  ;Clear Log
              ClearGadgetItemList(2)
              
            Case 10 ;Refresh Memory
              time.l = GetTickCount_()
              EnumAllWindows()
              time.l = GetTickCount_() - time
              AddLog("Enum windows in " + Str(time) + " ms.")
              AddLog(Str(CountList(Window())) + " windows found")
            
            Case 11 ;Refresh List
              time.l = GetTickCount_()
              RefreshList(1)
              time.l = GetTickCount_() - time
              AddLog("Refresh list in " + Str(time) + " ms.")
            
            Case 12 ;Open All Nodes
              time.l = GetTickCount_()
              RefreshList(2)
              time.l = GetTickCount_() - time
              AddLog("Opened all nodes in " + Str(time) + " ms.")
            
            Case 14 ;Open Whole Node
              time.l = GetTickCount_()
              RefreshList(8)
              time.l = GetTickCount_() - time
              AddLog("Opened whole node in " + Str(time) + " ms.")
            
            Case 16 ;Post Quit
              PostMessage_(Window()\handle, #wm_quit, 0, 0)
            Case 17 ;Post Close
              PostMessage_(Window()\handle, #wm_close, 0, 0)
            
            Case 18 ;Terminate Process
              Result.l = OpenProcess_(#PROCESS_ALL_ACCESS, #True, Window()\process) 
              If Result
                If terminateprocess_(Result, 0)
                  AddLog("The process with the ID " + Str(Window()\process) + " was successfully terminated.")
                  DelProcInList(Window()\process)
                  AddLog("List refresh needed")
                EndIf
                closehandle_(Result)
              EndIf
            
            Case 20 ;CloseWindow_
              CloseWindow_(Window()\handle)
            
            Case 21 ;DestroyWindow_
              DestroyWindow_(Window()\handle)
            
            Case 22 ;Window Info
              Text.s = GetWindowInfo(Window()\handle)
              SetGadgetText(4, Text)
              SetGadgetState(5, 1)
              ActivateGadget(0)
              
            Case 23 ;GetDesktopWindow_
              Result.l = GetDesktopWindow_()
              If Result
                SetCursorOnHandle(Result)
              EndIf
              
            Case 24 ;GetForegroundWindow_
              Result.l = GetForegroundWindow_()
              If Result
                SetCursorOnHandle(Result)
              EndIf
            
            Case 25 ;GetNextWindow_
              Result.l = GetWindow_(Window()\handle, #GW_HWNDNEXT)
              If Result
                SetCursorOnHandle(Result)
                AddLog("Handle: " + Str(Result))
              Else
                AddLog("No next Window")
              EndIf
            
            Case 26 ;GetPrevWindow_
              Result.l = GetWindow_(Window()\handle, #GW_HWNDPREV)
              If Result
                SetCursorOnHandle(Result)
                AddLog("Handle: " + Str(Result))
              Else
                AddLog("No previous Window")
              EndIf
            
;             Case 27 ;HideWindow_
;               If Result
;                 DestroyWindow_(Result)
;               EndIf
          EndSelect
      EndSelect
    ForEver
  EndIf
EndIf
End
bossi
Beiträge: 12
Registriert: 07.10.2004 19:40

Beitrag von bossi »

auch dieser code mach ärger :roll:
fehler line 661 (constant not found "#PROCESS_ALL_ACCESS") Result.l = OpenProcess_(#PROCESS_ALL_ACCESS, #True, Window()\process)
Benutzeravatar
NicTheQuick
Ein Admin
Beiträge: 8808
Registriert: 29.08.2004 20:20
Computerausstattung: Ryzen 7 5800X, 64 GB DDR4-3200
Ubuntu 24.04.2 LTS
GeForce RTX 3080 Ti
Wohnort: Saarbrücken

Beitrag von NicTheQuick »

:freak: Wieso fehlen allen möglichen Leuten diese Konstanten?
Gehts damit?

Code: Alles auswählen

#PROCESS_ALL_ACCESS=$FFF
bossi
Beiträge: 12
Registriert: 07.10.2004 19:40

Beitrag von bossi »

jo dann funzt es teilweise :roll: wieder der fehler in der if gadget(a) abfrage

Repeat
If Width <> WindowWidth() Or Height <> WindowHeight()
Width = WindowWidth()
Height = WindowHeight()
ResizeGadget(0, -1, -1, Width - #T1Width - 5, Height - #PanelHeight - 5)
ResizeGadget(2, -1, -1, Width - #T1Width - 52, -1)
ResizeGadget(3, Width - #T1Width - 50, -1, -1, -1)
ResizeGadget(4, -1, -1, Width - #T1Width - 10, -1)
ResizeGadget(5, -1, Height - #PanelHeight, Width - #T1Width - 5, -1)
For a.l = 10 To 26
fehler line 628 : If GadgetID(a)
ResizeGadget(a, Width - #T1Width, -1, -1, -1)
EndIf
Next
EndIf
Benutzeravatar
NicTheQuick
Ein Admin
Beiträge: 8808
Registriert: 29.08.2004 20:20
Computerausstattung: Ryzen 7 5800X, 64 GB DDR4-3200
Ubuntu 24.04.2 LTS
GeForce RTX 3080 Ti
Wohnort: Saarbrücken

Beitrag von NicTheQuick »

Hä? also bei mir funktioniert es wunderbar. Und ich habe auch die gleiche Version wie du. Nämlich PB V 3.91. Komisch.

Aber wenn generell irgendwo sowas steht wie [c]If GadgetID(a)[/c], dann kannst du das auch einfach durch [c]If IsGadget(a)[/c] ersetzen.
bossi
Beiträge: 12
Registriert: 07.10.2004 19:40

Beitrag von bossi »

hi nic,
also die änderung auf IsGadget(a) bringt nix, habe die resize entfernt.
sieht ja toll aus was da alles zu sehen ist, nur ist mir das ne nummer zu hoch. :freak:
es währe schön wen du dir das beispiel von GPI mal anschaust und mir sagst wie ich den speicherinhalt eines bestimmten handles auslesen.
und diesen string z.b. in ein gadgetedit einfüge :roll:

gruß
bossi
bossi
Beiträge: 12
Registriert: 07.10.2004 19:40

Beitrag von bossi »

hi,
also es geht mir im grunde um ein webgadget das mit frames ist.
ich möchte nun von ein bestimmten frame den HTLM quellcode ODER inhalt haben.
hat man da eine möglichkeit, es kann auch ein webgadget via PB erzeugt werden und mit der seite gefüllt werden ?

bye
bossi
Antworten