以下代码中的playsoundW出现问题. [英] Problem with playsoundW in the following code.

查看:124
本文介绍了以下代码中的playsoundW出现问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 switch (LOWORD (wParam))
 {
	case IDC_PLAY:
	static char textmessage[256];
	SendMessage((HWND)lParam,WM_GETTEXT,(WPARAM)256,(LPARAM)textmessage);				
					
	if( strncmp(textmessage, "Play", 4)==0)
	{
	    PlaySoundW(L"C:\Users\Chaiein\Downloads\oscilloscope_src\sound1.wav",NULL, SND_FILENAME);
	    SetWindowText((HWND)lParam,"Stop");
	}
		.....
}		



即使我给出了使其完整工作的完整路径,我也听不到sound1.wav中的音乐?



I am not getting the music that in sound1.wav even if I give full path how to make it work?

推荐答案

问题出在您的文件名上.编译器使用单个\作为转义序列的开始.就像使用\ n作为换行符的转义序列一样.

解决方案是
  • 全部使用\\代替\
  • 全部使用/代替\
The problem is with your filename. The compiler is using the single \ as the start of escape sequences. You know, just like you use \n as the escape sequence for a newline.

The solution is to either
  • Make them all \\ instead of \
  • Make them all / instead of \


这篇关于以下代码中的playsoundW出现问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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