String ^ fileName = textBox5->Text + "DES.wav";
PlaySound(fileName, NULL, SND_FILENAME | SND_SYNC);
The error is saying:
Error 4 error C2664: 'PlaySoundW' : cannot convert parameter 1 from 'System::String ^' to 'LPCWSTR'
String ^ fileName = textBox5->Text + "DES.wav";
PlaySound(fileName, NULL, SND_FILENAME | SND_SYNC);
The error is saying:
Error 4 error C2664: 'PlaySoundW' : cannot convert parameter 1 from 'System::String ^' to 'LPCWSTR'
No need to mix managed and unmanaged code, use SoundPlayer
class:
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