SND_MEMORY = 0x0004,
SND_LOOP = 0x0008,
SND_NOSTOP = 0x0010,
SND_NOWAIT = 0x00002000,
SND_ALIAS = 0x00010000,
SND_ALIAS_ID = 0x00110000,
SND_FILENAME = 0x00020000,
SND_RESOURCE = 0x00040004
}
[DllImport("CoreDll.DLL", EntryPoint = "PlaySound", SetLastError = true)]
private extern static int PlaySound(string szSound, IntPtr hMod, int flags);
[DllImport("CoreDll.DLL", EntryPoint = "PlaySound", SetLastError = true)]
private extern static int PlaySoundBytes(byte[] szSound, IntPtr hMod,
int flags);
/// <summary>
/// Конструктор объекта Sound, который проигрывает звук из
/// указанного файла
/// </summary>
public Sound(string fileName) {
m_fileName = fileName;
}
/// <summary>
/// Конструктор объекта Sound, который проигрывает звук из
/// ресурсов
/// </summary>
public Sound(Stream stream) {
// читаем данные из потока
m_soundBytes = new byte[stream.Length];
stream.Read(m_soundBytes, 0, (int)stream.Length);
}