|
From: juvi on 7 Jul 2008 10:30 Thank you now it works..... but what is the SoundType "File"??? "Peter Foot" wrote: > The GetCurrentSoundType method is returning the current soundType in the > SoundType argument which is passed by reference. > > Peter > > -- > Peter Foot > Microsoft Device Application Development MVP > peterfoot.net | appamundi.com | inthehand.com > APPA Mundi Ltd - Software Solutions for a Mobile World > In The Hand Ltd - .NET Components for Mobility > > "juvi" <juvi(a)discussions.microsoft.com> wrote in message > news:E5B471A9-27CA-48D9-877F-1D7CBAE6A938(a)microsoft.com... > > Thank you for your reply, but do not get your class work: > > > > How can I use this? If I understand it correctly then I can set or get the > > current "profile" with this class on classic/professional. > > > > How can I get the current soundType?? > > > > thx > > > > "Achim Bohmann" wrote: > > > >> Hi Juvi, > >> > >> as far as I understand, you are searching for the same methods I was > >> searching some weeks ago. > >> > >> use the following class as your helper class. > >> > >> hth, > >> Achim > >> > >> public static class RingerNotification { > >> private static SNDFILEINFO mOldSoundFileInfo = new > >> SNDFILEINFO(); > >> > >> private enum SoundEvent { > >> All = 0, > >> RingLine1, > >> RingLine2, > >> KnownCallerLine1, > >> RoamingLine1, > >> RingVoip > >> } > >> > >> public 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 static bool SetRingerVibrate() { > >> SNDFILEINFO sfi = new SNDFILEINFO(); > >> sfi.SstType = SoundType.Vibrate; > >> uint ret = SndSetSound( SoundEvent.All, ref sfi, true ); > >> if( ret != 0 ) { > >> return false; > >> } > >> return true; > >> } > >> > >> public static bool SetRingerOff() { > >> SNDFILEINFO sfi = new SNDFILEINFO(); > >> sfi.SstType = SoundType.None; > >> uint ret = SndSetSound( SoundEvent.All, ref sfi, true ); > >> if( ret != 0 ) { > >> return false; > >> } > >> return true; > >> } > >> > >> public static bool SetRingerOn() { > >> SNDFILEINFO sfi = new SNDFILEINFO(); > >> sfi.SstType = SoundType.On; > >> uint ret = SndSetSound( SoundEvent.All, ref sfi, true ); > >> if( ret != 0 ) { > >> return false; > >> } > >> return true; > >> } > >> > >> public static bool SaveSound() { > >> uint ret = SndGetSound( SoundEvent.All, ref > >> mOldSoundFileInfo ); > >> if( ret != 0 ) { > >> return false; > >> } > >> return true; > >> } > >> > >> public static bool RestoreSound() { > >> uint ret = SndSetSound( SoundEvent.All, ref > >> mOldSoundFileInfo, true ); > >> if( ret != 0 ) { > >> return false; > >> } > >> return true; > >> } > >> > >> public static bool GetCurrentSoundType( ref SoundType > >> SoundType ) { > >> SNDFILEINFO sfi = new SNDFILEINFO(); > >> uint ret = SndGetSound( SoundEvent.All, ref sfi ); > >> SoundType = sfi.SstType; > >> if( ret != 0 ) { > >> return false; > >> } > >> return true; > >> } > >> } > >> >
From: Peter Foot on 7 Jul 2008 11:20 That is only relevant when used on Smartphone where you can set the sound type for individual events e.g. assigning a file to the line1 ringer. Peter -- Peter Foot Microsoft Device Application Development MVP peterfoot.net | appamundi.com | inthehand.com APPA Mundi Ltd - Software Solutions for a Mobile World In The Hand Ltd - .NET Components for Mobility "juvi" <juvi(a)discussions.microsoft.com> wrote in message news:74A44E29-B5FB-4B91-A84D-192EB0FA0CD1(a)microsoft.com... > Thank you now it works..... but what is the SoundType "File"??? > > "Peter Foot" wrote: > >> The GetCurrentSoundType method is returning the current soundType in the >> SoundType argument which is passed by reference. >> >> Peter >> >> -- >> Peter Foot >> Microsoft Device Application Development MVP >> peterfoot.net | appamundi.com | inthehand.com >> APPA Mundi Ltd - Software Solutions for a Mobile World >> In The Hand Ltd - .NET Components for Mobility >> >> "juvi" <juvi(a)discussions.microsoft.com> wrote in message >> news:E5B471A9-27CA-48D9-877F-1D7CBAE6A938(a)microsoft.com... >> > Thank you for your reply, but do not get your class work: >> > >> > How can I use this? If I understand it correctly then I can set or get >> > the >> > current "profile" with this class on classic/professional. >> > >> > How can I get the current soundType?? >> > >> > thx >> > >> > "Achim Bohmann" wrote: >> > >> >> Hi Juvi, >> >> >> >> as far as I understand, you are searching for the same methods I was >> >> searching some weeks ago. >> >> >> >> use the following class as your helper class. >> >> >> >> hth, >> >> Achim >> >> >> >> public static class RingerNotification { >> >> private static SNDFILEINFO mOldSoundFileInfo = new >> >> SNDFILEINFO(); >> >> >> >> private enum SoundEvent { >> >> All = 0, >> >> RingLine1, >> >> RingLine2, >> >> KnownCallerLine1, >> >> RoamingLine1, >> >> RingVoip >> >> } >> >> >> >> public 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 static bool SetRingerVibrate() { >> >> SNDFILEINFO sfi = new SNDFILEINFO(); >> >> sfi.SstType = SoundType.Vibrate; >> >> uint ret = SndSetSound( SoundEvent.All, ref sfi, true ); >> >> if( ret != 0 ) { >> >> return false; >> >> } >> >> return true; >> >> } >> >> >> >> public static bool SetRingerOff() { >> >> SNDFILEINFO sfi = new SNDFILEINFO(); >> >> sfi.SstType = SoundType.None; >> >> uint ret = SndSetSound( SoundEvent.All, ref sfi, true ); >> >> if( ret != 0 ) { >> >> return false; >> >> } >> >> return true; >> >> } >> >> >> >> public static bool SetRingerOn() { >> >> SNDFILEINFO sfi = new SNDFILEINFO(); >> >> sfi.SstType = SoundType.On; >> >> uint ret = SndSetSound( SoundEvent.All, ref sfi, true ); >> >> if( ret != 0 ) { >> >> return false; >> >> } >> >> return true; >> >> } >> >> >> >> public static bool SaveSound() { >> >> uint ret = SndGetSound( SoundEvent.All, ref >> >> mOldSoundFileInfo ); >> >> if( ret != 0 ) { >> >> return false; >> >> } >> >> return true; >> >> } >> >> >> >> public static bool RestoreSound() { >> >> uint ret = SndSetSound( SoundEvent.All, ref >> >> mOldSoundFileInfo, true ); >> >> if( ret != 0 ) { >> >> return false; >> >> } >> >> return true; >> >> } >> >> >> >> public static bool GetCurrentSoundType( ref SoundType >> >> SoundType ) { >> >> SNDFILEINFO sfi = new SNDFILEINFO(); >> >> uint ret = SndGetSound( SoundEvent.All, ref sfi ); >> >> SoundType = sfi.SstType; >> >> if( ret != 0 ) { >> >> return false; >> >> } >> >> return true; >> >> } >> >> } >> >> >>
First
|
Prev
|
Pages: 1 2 Prev: How to open built-in call history manager ? Next: Problem installing Windows Mobile 6 SDKs |