AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Vom Handle zur Position und Größe einer Form
Thema durchsuchen
Ansicht
Themen-Optionen

Vom Handle zur Position und Größe einer Form

Ein Thema von Jelly · begonnen am 16. Jan 2005 · letzter Beitrag vom 22. Mai 2005
Antwort Antwort
Benutzerbild von Ultimator
Ultimator

Registriert seit: 17. Feb 2004
Ort: Coburg
1.860 Beiträge
 
FreePascal / Lazarus
 
#1

Re: Vom Handle zur Position und Größe einer Form

  Alt 16. Jan 2005, 11:23
Ich glaube, da ist getWindowRect das richtige für dich

Zitat:
The GetWindowRect function retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.

BOOL GetWindowRect(

HWND hWnd, // handle of window
LPRECT lpRect // address of structure for window coordinates
);

Parameters

hWnd

Identifies the window.

lpRect

Points to a RECT structure that receives the screen coordinates of the upper-left and lower-right corners of the window.
Noch was zum o.g. Rect:

Zitat:
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.

typedef struct _RECT { // rc
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT;


Members

left

Specifies the x-coordinate of the upper-left corner of the rectangle.

top

Specifies the y-coordinate of the upper-left corner of the rectangle.

right

Specifies the x-coordinate of the lower-right corner of the rectangle.

bottom

Specifies the y-coordinate of the lower-right corner of the rectangle.
[edit] Noch schnell n Beispiel, es geht nämlich einfach mit nem TRect als _RECT
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var MyRect:TRect;
begin
GetWindowRect(Form1.Handle,MyRect);
ShowMessage('Links oben: X: '+inttostr(MyRect.TopLeft.X) +', Y: '+ inttostr(MyRect.TopLeft.Y)+
  #10#13+'Rechts unten: X: '+inttostr(MyRect.BottomRight.X)+', Y: '+inttostr(MyRect.BottomRight.Y));
end;
Julian J. Pracht
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:43 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz