使用 CreateProcess 在隐藏窗口中播放媒体
我刚刚用文本模式C++开发了一个小游戏,我真正想做的是,当游戏启动时,它应该在隐藏模式下生成一个媒体播放器并播放mp3文件,我也想在程序关闭时关闭媒体播放器或者当我想要它时,我在互联网上搜索并发现 CreateProcess() (包含在 shellapi.h 中)可以完成这项工作,但我发现使用 ShellExecute() 生成应用程序要容易得多,但它不允许当我关闭它时想要它,所以我想要一个执行该工作的 CreateProcess 函数的工作示例代码,假设媒体播放器是“C:\wmplayer.exe”,mp3 文件是“C:\1.mp3” ...我打开MP3播放器有点成功,但无法播放MP3。我希望我能在这里得到帮助。问候
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 would 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用链接到您的应用程序的编程接口会更好。例如,请查看以下问题以获取一些指导:
尝试在不同进程中控制 mp3 播放器应用程序类似于放牧猫。
You would be far better of using a programmatic interface linked to your application. For example look at the following questions for some pointers:
Trying to control mp3 player apps in different processes is akin to herding cats.