Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi procedure ausführen, wenn fenster maximiert wurde (https://www.delphipraxis.net/38685-procedure-ausfuehren-wenn-fenster-maximiert-wurde.html)

idontwantaname 22. Jan 2005 20:41


procedure ausführen, wenn fenster maximiert wurde
 
hi! :hi:

ich weiß nicht, ob ich hier richtig bin, aber ich versuche es halt mal

ich hab schon mit google gesucht, aber nix zu meinem problem gefunden:
ich will eine procedure bzw. function ausführen, nachdem das fenster maximiert wurde

leider hab ich überhaupt keine ahnung, was ich machen soll, oder welceh message ich verwenden soll, denn mit WM_SIZE ist das ein bisschen schwierig herauszufinden, oder mir fällt nur keine lösung ein

hoffentlich könnt ihr mir weiterhelfen, wäre euch sehr dankbar
oliver :hi:

TStringlist 22. Jan 2005 21:01

Re: procedure ausführen, wenn fenster maximiert wurde
 
Control subclassen und danach nach WM_SIZE Ausschau halten plus: wParam dann auf SIZE_MAXIMIZED checken. Also ungefähr so:


Delphi-Quellcode:
var
  Form1: TForm1;
  OldWndProc : cardinal;

implementation

{$R *.dfm}

function Edit1WndProc(hWnd1: hWnd; uMsg: UInt; wP: WParam; lP : LParam) : LResult; stdcall;
begin
  if uMsg = WM_Size then
    if wP = SIZE_MAXIMIZED then beep; // oder sonst eine Proc aufrufen
  Result := CallWindowProc(Pointer(OldWndProc), hWnd1, uMsg, wP, lP);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  OldWndProc := SetWindowLong(TWinControl(Form1).Handle,GWL_WndProc,integer(@Edit1WndProc));
end;

idontwantaname 22. Jan 2005 21:11

Re: procedure ausführen, wenn fenster maximiert wurde
 
thx, das funktioniert

hier nochmal mein code

Delphi-Quellcode:
private
  procedure WMSize(var Message: TMessage); message WM_SIZE;

{....}

procedure TForm1.WMSize(var Message: TMessage);
begin
    if (Message.WParam = SIZE_MAXIMIZED) then
    begin
        ShowMessage('huhu');
    end;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:25 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