String ^ fileName = textBox5->Text + "DES.wav";
PlaySound(fileName, NULL, SND_FILENAME | SND_SYNC);
错误是说:
错误 4 错误 C2664:“PlaySoundW”:无法将参数 1 从“System::String ^”转换为“LPCWSTR”
String ^ fileName = textBox5->Text + "DES.wav";
PlaySound(fileName, NULL, SND_FILENAME | SND_SYNC);
错误是说:
错误 4 错误 C2664:“PlaySoundW”:无法将参数 1 从“System::String ^”转换为“LPCWSTR”
无需混合托管和非托管代码,使用SoundPlayer
类:
String ^ fileName = textBox5->Text + "DES.wav";
SoundPlayer^ player = gcnew SoundPlayer(filename);
player->PlaySync(); // or Play for asynchronous execution
http://msdn.microsoft.com/en-us/library/system.media.soundplayer.aspx