Menu

Playing a media file

2007-09-22
2012-09-26
  • Martian Man

    Martian Man - 2007-09-22

    I posted a question on how to open a media file, now I want to know how I get the file to open w/ my program instead of Windows Media Player. Can someone help? If you could post the code here that would be helpful (P.S. I don't want to hide the Windows Media Player window, I want to make the file play w/ my program.)

     
    • Osito

      Osito - 2007-09-22

      I have this in one of my programs to play some wav files without using Media Player:

      (in .rc file)
      StartWave WAVE "start.wav"
      StopWave WAVE "stop.wav"

      (in main code)
      PlaySound("StartWave", g_hInst, SND_RESOURCE | SND_ASYNC);
      PlaySound("StopWave", g_hInst, SND_RESOURCE | SND_ASYNC);

      Note that g_hInst is a global copy of the first argument, HINSTANCE, in WinMain(), which I'm sure is a bad way to do it but that's how the example was written and I didn't bother messing with it.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.