1. Home
  2. Computing & Technology
  3. Delphi Programming

How to detect when a TMediaPlayer stops playing

By , About.com Guide

The Notify property resets back to False when a notify event is triggered, so in order for you to recieve further notify events, you have to set it back to True as in the code. for the MODES available, see the helpfile for MediaPlayer.Mode.

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.FormCreate(Sender: TObject) ;
begin
   MediaPlayer1.Notify := True;
   MediaPlayer1.OnNotify := NotifyProc;
end;

procedure TForm1.NotifyProc(Sender: TObject) ;
begin
   with Sender as TMediaPlayer do
   begin
     case Mode of
       mpStopped: {DO something HERE};
     end;
     //must set to true to
     //enable next-time notification
     Notify := True;
   end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Disable LogOff, TaskManager and ShutDown on Win NT systems (2000/XP)
« How to get the number of words in Richedit

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2002 Delphi Tips
  7. How to detect when a TMediaPlayer stops playing

©2009 About.com, a part of The New York Times Company.

All rights reserved.