Einzelnen Beitrag anzeigen

Tyrael Y.

Registriert seit: 28. Jul 2003
Ort: Stuttgart
1.093 Beiträge
 
Delphi 2007 Professional
 
#3

Re: Titel von versteckten Fenstern ermitteln

  Alt 7. Okt 2003, 13:35
also das hier ist ein Testprojekt und leifert leider
nicht alle Fenstertitel

Code:
program wndTitle;
uses
  windows, sysutils;

var
  s, ctext, cctext: string;
{$APPTYPE CONSOLE}


function myEnumcChildWindows(ccHWnd: HWnd; ccLParam:integer): BOOL; stdcall;
var
  ccl, ccln : integer;
  ccClass:String;
begin
  ccl := GetWindowTextLength(ccHwnd);
  if (ccl > 0) then
  begin
    SetLength(cctext, ccl+1);
    GetWindowText(ccHwnd, PChar(cctext), ccl+1);
    SetLength(ccClass, 1025);
    ccln := GetClassName(ccHwnd, PChar(ccClass), 1024);
    Setlength(ccClass, ccln);

    writeln('--------------------------------------------');
    writeln('cChildTitle: ' +ccText);
    writeln('cChildHandle: ' + IntToStr(ccHwnd));
    writeln('cChildClassname: ' + ccClass);
    writeln('--------------------------------------------');
    Readln;
  end;
  result := true;
end;



function myEnumChildWindows(cHWnd: HWnd; cLParam:integer): BOOL; stdcall;
var
  cl, cln : integer;
  cClass:String;
begin
  cl := GetWindowTextLength(cHwnd);
  if (cl > 0) then
  begin
    SetLength(ctext, cl+1);
    GetWindowText(cHwnd, PChar(ctext), cl+1);
    SetLength(cClass, 1025);
    cln := GetClassName(cHwnd, PChar(cClass), 1024);
    Setlength(cClass, cln);

    writeln('--------------------------------------------');
    writeln('ChildTitle: ' +cText);
    writeln('ChildHandle: ' + IntToStr(cHwnd));
    writeln('ChildClassname: ' + cClass);
    writeln('--------------------------------------------');

    EnumChildWindows(cHwnd, @myEnumcChildWindows, 0);
    Readln;
  end;
  result := true;
end;

function myEnumProc(aHWnd: HWnd; aLParam: integer): BOOL; stdcall;
var
  tl, aln: integer;
  aClass:string;
begin

  tl := GetWindowTextLength(aHWnd);
  if (tl > 0) then
  begin
    //für Fenster
    SetLength(s, tl+1);
    GetWindowText(aHWnd, PChar(s), tl+1);
    SetLength(aClass, 1025);
    aln := GetClassName(aHwnd, PChar(aClass), 1024);
    Setlength(aClass,aln);




    writeln('Title: ' +s);
    writeln('Handle: ' + IntToStr(aHwnd));
    writeln('Classname: ' + aClass);

    EnumChildWindows(aHWnd, @myEnumChildWindows, 0);

   
    writeln('*************************************************');
    writeln('*************************************************');
    readln;
  end;
  result := true; // To continue enumeration.
end;

begin
  EnumWindows(@myEnumProc, 0);
end.
Levent Yildirim
Erzeugung von Icons aus Bildern:IconLev
  Mit Zitat antworten Zitat