View Single Post
Old 04-24-2008, 08:09 PM   #1 (permalink)
PigBenis
duh
 
PigBenis's Avatar
 
Join Date: May 2002
Location: Boiler Up
Posts: 567
-22 Internets
Send a message via AIM to PigBenis
CF .net p/invoke reading the phones current ringer

Hey guys i'm working on a project at school in a mobile development class. I'm trying to read the current ringer settings on a phone (vibrate, off, on). There is no direct class for this so it has to be done through a platform invoke. I was able to find the code online to set the ringer here:
Code:
using System; using System.Runtime.InteropServices; public enum SoundEvent { All = 0, RingLine1, RingLine2, KnownCallerLine1, RoamingLine1, RingVoip } public enum SoundType { On = 0, File, Vibrate, None } public class clsNotification { [DllImport("aygshell.dll", SetLastError = true)] public static extern uint SndSetSound(SoundEvent seSoundEvent, clsNotification pSoundFileInfo, bool fSuppressUI); [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] private string szPathNameNative; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] private string szDisplayNameNative; public SoundType SstType; private string szPathName { get { return szPathNameNative.Substring(0, szPathNameNative.IndexOf('\0')); } set { szPathNameNative = value; } } private string szDisplayName { get { return szDisplayNameNative.Substring(0, szDisplayNameNative.IndexOf('\0')); } set { szDisplayNameNative = value; } } }
I'm trying to now get the current ringer. aygshell.dll has an API for this called SndGetSound. Unfortunately, I really have no idea on how to set this up. I'm certain it's very similar to the SndSetSound, but I've really tried everything and can't get it to work. Can anyone help me out? Here's a link to SndGetSound from MSDN: SndGetSound

Thanks for any help guys.
PigBenis is offline   Reply With Quote

 
Uberguilds Network