using CreateProcess to to play media in hidden window
i just developed a tiny little game in textmode c++, what i actually wanted to do is that when the game starts it should spawn a media player in hidden mode and play the mp3 file, also i want to close the media player when the program closes or when i want it to, i have searched over the internet and found that CreateProcess() (included in shellapi.h) does this job, but i have seen that spawning an app using ShellExecute() is much easier but it does not let me Close it when i want it to, so i w开发者_如何学JAVAould like to have a working example code of the CreateProcess function that does the job, suppose that the media player is "C:\wmplayer.exe" and the mp3 file is "C:\1.mp3"... i have been a little successful in opening the mp3 player but couldnot play the mp3. i hope i'll get helped here. Regards
You would be far better of using a programmatic interface linked to your application. For example look at the following questions for some pointers:
- How to play MP3 files in C?
- How to play mp3 file in c++?
- Playing sounds with C++?
Trying to control mp3 player apps in different processes is akin to herding cats.
精彩评论