Seite 1 von 1

GetWindowTitle() mit Handle anstatt #Window

Verfasst: 17.01.2014 15:58
von Joshua314
Hallo Leute,

ich suche eine Möglichkeit den Title von einem Beliebigen Window abzufragen, dessen Handle ich habe.


Den Handle bekomme ich durch.

Code: Alles auswählen

Procedure Callback(HWND.l, P.l)
  Debug "Handle "+Str(HWND)
  ProcedureReturn #True
EndProcedure


Debug EnumWindows_(@Callback(),0)
Ich brache jetzt dazu den Title.

Gruß Thomas

Re: GetWindowTitle() mit Handle anstatt #Window

Verfasst: 17.01.2014 16:04
von RSBasic

Code: Alles auswählen

EnableExplicit

Define Handle = FindWindow_("notepad", #Null)
Define WindowTitle$
Define WindowLength

If Handle
  WindowLength = GetWindowTextLength_(Handle)+1
  WindowTitle$ = Space(WindowLength)
  GetWindowText_(Handle, @WindowTitle$, WindowLength)
  Debug WindowTitle$
  
EndIf

Re: GetWindowTitle() mit Handle anstatt #Window

Verfasst: 17.01.2014 16:06
von Bisonte
da wäre GetWindowText_() im Angebot :

Code: Alles auswählen

Procedure Callback(hWnd, p)

  If IsWindow_(hWnd)
    lpString.s = Space(1024)
    GetWindowText_(hWnd, @lpString, 1024)   
    If lpString<>""
      Debug lpString
    EndIf
  EndIf
  
  ProcedureReturn #True
  
EndProcedure

Debug EnumWindows_(@Callback(),0) 

Re: GetWindowTitle() mit Handle anstatt #Window

Verfasst: 17.01.2014 16:12
von Joshua314
Danke.. an Alle
Gruß Thomas