关于C ++ MFC CButton异步 [英] About C++ MFC CButton Asynchronous

查看:57
本文介绍了关于C ++ MFC CButton异步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我对使用MFC编程的C ++非常陌生。

我正在做一个学校项目,即建立a。使用C ++和MFC的.WAV播放器。我必须使用较低级别的API但不能简单地调用PlaySound(_T(filename.wav),NULL,SND_FILENAME | SND_ASYNC);播放.WAV文件。



播放功能已经实现,但是,我不知道如何实现停止功能,如当我按下播放按钮(触发播放功能)时,播放功能会锁定所有其他按钮,我无法按停止按钮停止音乐播放。



有没有提示我实现这样的停止功能?它是与异步,多线程或其他相关的东西吗?



感谢任何有价值的回复。

解决方案

http://www.cplusplus.com/forum/windows/96349/一样 [ ^ ]已经说过,你需要发布一些代码 - 这是一个标志为SND_ASYNC的PlaySound非常不寻常的行为!



无论如何你不需要任何新的线程,你可以通过以下方式停止声音:



 PlaySound(NULL, 0  0 ); 


Dear all,

I am very new to C++ with MFC Programming.
I am doing a school project which is to build a .WAV player using C++ with MFC. I must use the lower level API BUT CANNOT simply a call to "PlaySound(_T("filename.wav"), NULL, SND_FILENAME | SND_ASYNC);" to play the .WAV file.

The "play" function is already implemented, however, I don''t konw how to implement the "stop" function, as when I press the "play" button (which trigger the "play" function), the "play" function LOCKs all other buttons, I cannot press the "stop" button to stop the music playing.

Are there any hints for me to implement such a "stop" function? Is it something related to "asynchronous", "multi-threading" or something else?

THANKS IN ADVANCE for any valuable reply.

解决方案

As in http://www.cplusplus.com/forum/windows/96349/[^] already said, you need to post some code - it is very unusual behavior of a PlaySound with flag SND_ASYNC !

Anyway you don''t need any new thread and you can stop sound with:

PlaySound(NULL, 0, 0);


这篇关于关于C ++ MFC CButton异步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆