Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#8

AW: FindMemo, FindEdit

  Alt 7. Feb 2017, 17:48
Beispiel. (copy\paste)

Delphi-Quellcode:
function EnumChildProc(AHandle: THandle; AItems: TStrings): BOOL; stdcall;
var
  buffer: array[0..255] of Char;
  caption: array[0..255] of Char;
begin
  Result := True;
  GetClassName(AHandle, buffer, SizeOf(buffer)-1);
  SendMessage(AHandle, WM_GETTEXT, 256, Integer(@caption));

  AItems.Add(Format('Handle: %d, Class: %s, Text: %s', [AHandle, buffer, caption]));
end;

//...

procedure TForm1.Button1Click(Sender: TObject);
var
  wHnd: THandle;
  wCls: PChar;
begin
  wCls := PChar('YourTopWindowClassName'); // ex. TForm1
  wHnd := FindWindow(wCls, nil);
  ListBox1.Clear;
  // Get window controls into the listbox
  EnumChildWindows(wHnd, @EnumChildProc, Integer(ListBox1.Items));
end;
gruss
  Mit Zitat antworten Zitat