procedure TForm1.WndProc(var Message: TMessage);
var
WndPosFlag: Integer;
begin
if Message.Msg = WM_WINDOWPOSCHANGED then
begin
WndPosFlag := PWindowPos(Message.LParam)^.flags;
ListBox1.Items.Add(IntToStr(WndPosFlag));
case WndPosFlag of
6295: Windows.Beep(131, 500);
6147: Windows.Beep(147, 500);
end;
end;
inherited;
end;
procedure TForm1.WMSize(var Message: TWMSize);
begin
if (Message.SizeType = SIZE_MINIMIZED) then
ShowMessage('MINIMIZED');
end;
BUT... There is a bit of a trick here in that if the form you minimize is the project's main form then you will not get a WM_SIZE message, because you are really minimizing the application. This will result in ALL of your forms being minimized. That means it's tricky because what you may need is a way to switch which is the main form.
If this is what you're after let me know and I'll elaborate.
procedure TForm1.WndProc(var Message: TMessage);
var
WndPosFlag: Integer;
begin
if Message.Msg = WM_WINDOWPOSCHANGED then
begin
WndPosFlag := PWindowPos(Message.LParam)^.flags;
case WndPosFlag of
6295: Windows.Beep(333, 500);
end;
end;
inherited;
end;