String ^ fileName = textBox5->Text + "DES.wav";
PlaySound(fileName, NULL, SND_FILENAME | SND_SYNC);
错误在于:
错误4错误C2664:'PlaySoundW':无法将参数1从'System :: String ^'转换为'LPCWSTR'
答案 0 :(得分:0)
无需混合托管代码和非托管代码,请使用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