Registriert seit: 29. Mai 2002
37.621 Beiträge
Delphi 2006 Professional
|
Re: Window "Fenster" Handle bekommen
3. Apr 2008, 14:07
Delphi-Quellcode:
type
PMyEnumParam = ^TMyEnumParam;
TMyEnumParam = record
FMemo: TMemo;
end;
function EnumWindowsProc(const hWnd: THandle; Param: PMyEnumParam): LongBool; stdcall;
var
Len: Longint;
s: string;
rect: TRect;
begin
Result := True;
if not (IsWindow(hWnd) and IsWindowVisible(hWnd)) then
Exit;
Len := SendMessage(hWnd, WM_GETTEXTLENGTH, 0, 0);
if Len > 0 then
begin
SetLength(s, Len);
SendMessage(hWnd, WM_GETTEXT, Len + 1, Longint(Pchar(s)));
GetWindowRect(hWnd, rect);
s := s + ' TopLeft: ' + IntToStr(rect.TopLeft.X) + '|' + IntToStr(rect.TopLeft.Y) + ' BottomRight: ' + IntToStr(rect.BottomRight.X) + '|' + IntToStr(rect.BottomRight.Y);
Param.FMemo.Lines.Add(s)
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Param: TMyEnumParam;
begin
Param.FMemo := Memo1;
EnumWindows(@EnumWindowsProc, LPARAM(@Param));
end;
Michael Ein Teil meines Codes würde euch verunsichern.
|
|
Zitat
|