Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Was tun uMsg: UInt; wParam: WParam; lParam: LParam ? (https://www.delphipraxis.net/45970-tun-umsg-uint%3B-wparam-wparam%3B-lparam-lparam.html)

MisterNiceGuy 15. Mai 2005 19:23


Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Ich habe folgenden Code zum Andocken eines Fensters (Screensnap).
Delphi-Quellcode:
function WndProc(WndHWND: HWnd; uMsg: UInt; wParam: WParam; lParam: LParam): LResult; stdcall;
const
  DISTANCE = 20;
var
  MyWndPos: PWindowPos;
  WorkAreaRect: TRect;
begin
   Result := 0;

   case uMsg of
    WM_WINDOWPOSCHANGING: begin
      // Nötige Informationen holen
      SystemParametersInfo(SPI_GETWORKAREA, 0, @WorkAreaRect, 0);
      MyWndPos := PWINDOWPOS(lParam);

      // Oben und Unten
      if (MyWndPos.y <= DISTANCE) and
         (MyWndPos.y >= -DISTANCE) then
           MyWndPos.y := 0;
      if (MyWndPos.y + MyWndPos.cy > (WorkAreaRect.Bottom - DISTANCE)) and
         (MyWndPos.y + MyWndPos.cy < (WorkAreaRect.Bottom + DISTANCE)) then
           MyWndPos.y := WorkAreaRect.Bottom - MyWndPos.cy;

      // Links und Rechts
      if (MyWndPos.x <= DISTANCE) and
         (MyWndPos.x >= -DISTANCE) then
           MyWndPos.x := 0;
      if (MyWndPos.x + MyWndPos.cx > (WorkAreaRect.Right - DISTANCE)) and
         (MyWndPos.x + MyWndPos.cx < (WorkAreaRect.Right + DISTANCE)) then
           MyWndPos.x := WorkAreaRect.Right - MyWndPos.cx;
    end;

    WM_DESTROY: begin
      PostQuitMessage(0);
    end;

     else Result := DefWindowProc(WndHWND, uMsg, wParam, lParam);
   end;
end;
Ich würde nun gerne diese Funktion auf ein beliebiges Fenster dessen Handle ich habe anweden.
Leider scheitere ich an den Parametern.
Das Handle ist klar, aber was
Delphi-Quellcode:
uMsg: UInt; wParam: WParam; lParam: LParam
tun weiß ich nicht!

Hoffe ihr könnt mir helfen.

Christian Seehase 15. Mai 2005 19:37

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Moin MisterNiceGuy,

uMsg ist die Meldung mit der die WndProc aufgerufen wird.
In Deinem Beispiel würden die Meldungen WM_WINDOWPOSCHANGING und WM_DESTROY von der Procedure verarbeitet werden.

wParam und lParam enthalten die Parameter der jeweiligen Message.
Was diese jeweils genau bedeuten, musst Du bei der Message nachschlagen (z.B. im PSDK)

MisterNiceGuy 15. Mai 2005 19:53

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Uff das PSDK ist insgesagt 1,4 GB groß bei 25 MB pro Segment.

Die Funktion soll definitiv durch WM_WINDOWPOSCHANGING aufgerufen werden,
nur hab ich keine Ahnung was ich für WParam und LParam beim Aufruf einsetzen muss!

Pseudemys Nelsoni 15. Mai 2005 20:03

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Zitat:

Zitat von MSDN
WM_WINDOWPOSCHANGING Notification

--------------------------------------------------------------------------------

The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.

A window receives this message through its WindowProc function.


Syntax

WM_WINDOWPOSCHANGING

WPARAM wParam
LPARAM lParam;

Parameters

wParam
This parameter is not used.
lParam
Pointer to a WINDOWPOS structure that contains information about the window's new size and position.
Return Value

If an application processes this message, it should return zero.


Christian Seehase 15. Mai 2005 20:10

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Moin MisterNiceGuy,

zum einen musst Du nicht das ganze PSDK herunterladen, zum anderen kannst Du auch direkt im MSDN nachschauen (z.B. MSDN-Library durchsuchenWM_WINDOWPOSCHANGING
Ausserdem könnte es möglich sein, dass Du einige der erforderlichen Informationen in der Hilfe von D7 enthalten sind.
Bei der PE weiss ich das allerdings nicht genau (bei D2005 PE sind sie dabei).

MisterNiceGuy 15. Mai 2005 20:34

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Hat sich erledigt, ich gehe das Problem anders an. Vielen Dank für die Hilfe, alleine wäre ich nicht so weit gekommen.

toms 16. Mai 2005 00:10

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Zitat:

Zitat von MisterNiceGuy
Hat sich erledigt, ich gehe das Problem anders an. Vielen Dank für die Hilfe, alleine wäre ich nicht so weit gekommen.

Hallo!

Denkst du nicht, dass deine Lösung auch für andere interessant wäre?

MisterNiceGuy 16. Mai 2005 09:24

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Ja das stimmt schon, also mein Problem ist, dass ich nicht weiß, wie ich lParam verändern kann.

Sprint 16. Mai 2005 09:32

Re: Was tun uMsg: UInt; wParam: WParam; lParam: LParam ?
 
Zitat:

Zitat von MisterNiceGuy
also mein Problem ist, dass ich nicht weiß, wie ich lParam verändern kann.

Typecasten.


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz