View Single Post
Old 04-25-2008, 02:19 PM   #4 (permalink)
PigBenis
duh
 
PigBenis's Avatar
 
Join Date: May 2002
Location: Boiler Up
Posts: 599
-24 Internets
Send a message via AIM to PigBenis
Got it btw, had to make a structure...
Code:
using System; using System.Runtime.InteropServices; public class clsNotification { private enum SoundEvent { All = 0, RingLine1, RingLine2, KnownCallerLine1, RoamingLine1, RingVoip } private enum SoundType { On = 0, File = 1, Vibrate = 2, None = 3 } private struct SNDFILEINFO { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szPathNameNative; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szDisplayNameNative; public SoundType SstType; } [DllImport("aygshell.dll", SetLastError = true)] private static extern uint SndSetSound(SoundEvent seSoundEvent, ref SNDFILEINFO pSoundFileInfo, bool fSuppressUI); [DllImport("aygshell.dll", SetLastError = true)] private static extern uint SndGetSound(SoundEvent seSoundEvent, ref SNDFILEINFO pSoundFileInfo); public int SetRingerVibrate() { SNDFILEINFO sfi = new SNDFILEINFO(); sfi.SstType = SoundType.Vibrate; uint ret = SndSetSound(SoundEvent.All, ref sfi, true); if (ret != 0) { return 1; } return 0; } public int SetRingerOff() { SNDFILEINFO sfi = new SNDFILEINFO(); sfi.SstType = SoundType.None; uint ret = SndSetSound(SoundEvent.All, ref sfi, true); if(ret != 0) { return 1; } return 0; } public int SetRingerOn() { SNDFILEINFO sfi = new SNDFILEINFO(); sfi.SstType = SoundType.On; uint ret = SndSetSound(SoundEvent.All, ref sfi, true); if(ret != 0) { return 1; } return 0; } private SNDFILEINFO mOldSoundFileInfo = new SNDFILEINFO(); public int SaveSound() { uint ret = SndGetSound(SoundEvent.All, ref mOldSoundFileInfo); if(ret != 0) { return 1; } return 0; } public int RestoreSound() { uint ret = SndSetSound(SoundEvent.All, ref mOldSoundFileInfo, true); if(ret != 0) { return 1; } return 0; } }
PigBenis is offline   Reply With Quote

 
Uberguilds Network