문제

I found 2 ways for catching onMinimize event.

First: On FormResize event:

if MyForm.WindowState = wsMinimized then ......

Second: Declaring the message handler like this:

procedure WMSize(var Msg: TMessage); message WM_SIZE;

And then:

procedure TForm57.WMSize(var Msg: TMessage);
begin
  if Msg.WParam  = SIZE_MINIMIZED then ....
end;

Which way is better?!

도움이 되었습니까?

해결책

OnResize is fired in response to the same message (WM_SIZE). Unless you need to react before the VCL handles the message (update scrollbars, align controls etc.), you don't need to attach a message handler. Otherwise, be sure to handle it before the inherited call (which is missing in your sample).

다른 팁

second is better. as WindowState is not necessarily wsMinimized.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top