Fetch the movies handle when playing it and wait until media_playing returns zero for that handle:

http://www.conitec.net/beta/amedia_play.htm

http://www.conitec.net/beta/amedia_playing.htm


Always learn from history, to be sure you make the same mistakes again...