I use the following code to call MessageBeep from my VC++ .net window form
program
[DllImport("user32.dll", SetLastError=true)]
static bool MessageBeep(UINT type);
You don't need to go to that rigmarole - this is C++ not C#
Just #include said:
Try MessageBeep(MB_OK) - it should produce whatever system sound you
have set up in the Control Panel Sound setting.
Also I do not see the System::Media namespace in my Visual Studio 2003 .NET.
I don't have VS2003 installed, but the following works for me with
VS2008:
#include "stdafx.h"
#include<windows.h>
#pragma comment( lib, "User32.lib" )
using namespace System;
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
MessageBeep( -1 );
System::Media::SystemSounds::Beep->Play();
return 0;
}
Dave