Re: WMP doesn't play a media on a thread



From: "sisimma"

Is there anyone who can tell the difference between a
class, which maybe it runs on a process, and a thread,
which is created from the class?
[...]

You are comparing apple and oranges: a thread is a sequence
of operations executed at runtime while a class is just a
way to organize your source code for the compiler. All code
is executed on a thread, whether created by you or somebody
else, and regardless of where you put it in your source
files.

The problem here is that you seem to not be waiting for WMP
to even start playing, let alone finish playing, before
uninitializing COM and destroying the thread, without even
properly releasing WMP. You are most likely causing a
resource leak and you are lucky you are not causing a crash.
Most likely it works when you call the function from your
main thread simply because the main thread will keep running
giving WMP time to perform its task.

You must wait for WMP to finish playing, then you can
release it, uninitialize COM and let the thread exit. It
would be a good idea to also dispatch messages on this
thread while you wait for WMP to finish.

--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


.



Relevant Pages

  • Re: Now Playing no longer saves on close?
    ... Then it stops (not during a song, ... I click on it and WMP11 starts playing it's ... song played...or even the radio station I was playing...if I was doing ... cause I have WMP minimized as a toolbar. ...
    (microsoft.public.windowsmedia.player)
  • Re: continue playback after sleep
    ... the song it's playing, that bar is simply missing!?). ... Please do help me with this very irritating problem, or else WMP ... position from when i put the computer to sleep. ...
    (microsoft.public.windowsmedia.player)
  • Re: Using an External Hard Drive
    ... can only reveal on Now Playing the files in one of the folders on E: ... I've been trying for some time to play them using Windows Media Player, ... No Tom E. WMP is open on the Library tab with Playlists and Library ...
    (microsoft.public.windowsmedia.player)
  • Re: Why am i banned ?
    ... WMP 11 NOW PLAYING - Renaissance The Classics Part 2 ...
    (uk.games.video.xbox)
  • Re: Why am i banned ?
    ... WMP 11 NOW PLAYING - Renaissance The Classics Part 2 ...
    (uk.games.video.xbox)

Loading