Entwickler-Ecke

Windows API - Pointer lParam in Rect umwandeln


wulfskin - Di 04.03.03 21:53
Titel: Pointer lParam in Rect umwandeln
Hallo!

Ich habe gleich nochmal ein Problem: Wie kann ich den Zeiger, den ich in lParam bekomme, in ein Rect umwandeln?
Auszug aus dem PSDK:
Zitat:
lParam
Pointer to a RECT structure with the current position of the window, in screen coordinates. To change the position of the drag rectangle, an application must change the members of this structure.
Zweck: Die Nachricht WM_MOVING abfangen und auswerten!

Vielen Danke für Eure Hilfe!
Hans-Peter


MSCH - Di 04.03.03 21:59
Titel: Typecasting
Typecasting ist des Rätsels Lösung:

Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type
  PRect= ^TRect;
var
  PtrRect: PRect;
begin
   PtrRect:= PRect(Msg.lparam);
   PtrRect^.Left:=10;
end;


alle Angaben ohne Gewähr - konnte es grad nich proben.
Grüße
MSCH


Delete - Di 04.03.03 22:07


Quelltext
1:
2:
3:
4:
var
  rect : TRect;
begin
  rec := msg.lParam;


MSCH - Di 04.03.03 22:13

Das dürfte nicht funktionieren, da lparam ein ZEIGER auf TRect ist. TRect ist per se ein Record, KEIN Zeiger!

Luckie hat folgendes geschrieben:

Quelltext
1:
2:
3:
4:
var
  rect : TRect;
begin
  rec := msg.lParam;


Grüße
MSCH


wulfskin - Di 04.03.03 22:14
Titel: Re: Typecasting
MSCH hat folgendes geschrieben:
Typecasting ist des Rätsels Lösung:

Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
type
  PRect= ^TRect;
var
  PtrRect: PRect;
begin
   PtrRect:= PRect(Msg.lparam);
   PtrRect^.Left:=10;
end;


alle Angaben ohne Gewähr - konnte es grad nich proben.
Grüße
MSCH
Das war's! Hab alles ausprobiert, nur auf die Idee bin ich net gekommen, aber jetzt wo ich es sehe - dumm!

VIELE DANK LUCKIE!