Mirror

How to play a WAV file when minimizing or maximizing a window (Views: 100)


Problem/Question/Abstract:

How to play a WAV file when minimizing or maximizing a window

Answer:

Try the API SndPlaySound. It works fine without the need of visible components. Use the OnResize event and check WindowStatus for any changes.


procedure TForm1.FormResize(Sender: TObject);
begin
  case WindowStatus of
    wsMinimized: sndPlaySound('min.wav', );
    wsMaximized: sndPlaySound('max.wav', );
  end;
end;

<< Back to main page