Ringer to Vibrate

R

Roger Odermatt

Hello

Is it possible to change the Ringer to vibrate with WM6? When yes how can do
that?

Or is it possible to use on of the 4 Profiles on WM6? When yes, how can
change the Profiles on WM6?

Thank you very much

Roger
 
P

Peter Foot

Yes, you can P/Invoke the SndSetSound function. On Professional/Classic
devices the only supported Sound Event is SND_EVENT_ALL. You can set the
Sound Type to On, Vibrate or None.
On Standard (Smartphone) devices you set the different line ringtones
separately.

Peter
 
R

Roger Odermatt

Thank you very much!

Can i use this function only with C++ or is it also possible with the CF
2.0?

I hope it's possible with CF 2.0 then i don't write code with C++.

Thank you
Roger
 
P

Paul G. Tobey [eMVP]

As Peter said, "you can P/Invoke" the function. You'll have to build a
correct external declaration of the function which includes the correct
parameter types, the correct name (SndSetSound), and the name of the DLL
which implements the function (aygshell.dll).

Paul T.
 
G

Guest

I don't have a WinMo 6 device and I've not installed the SDKs so I don't
even have an emulator to test this code with, but it probably looks
something like what's below. The documentation isn't too helpful in telling
us what DLL it's in, so I guessed at coredll.dll. Might be cellcore.dll if
not.

// calling code:
uint ret = SndSetSound(SoundEvent.All, sfi, true);

// declaration
enum SoundEvent
{
All = 0,
RingLine1,
RingLine2,
KnownCallerLine1,
RoamingLine1,
RingVoip
}

enum SoundType
{
On = 0,
File,
Vibrate,
None
}

/*
typedef struct tagSNDFILEINFO {
TCHAR szPathName[MAX_PATH];
TCHAR szDisplayName[MAX_PATH];
SND_SOUNDTYPE sstType;
} SNDFILEINFO;
* */
class SoundFileInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szPathNameNative;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szDisplayNameNative;
public SoundType sstType;

public string szPathName
{
get { return szPathNameNative.Substring(0,
szPathNameNative.IndexOf('\0')); }
set { szPathNameNative = value; }
}

public string szDisplayName
{
get { return szDisplayNameNative.Substring(0,
szDisplayNameNative.IndexOf('\0')); }
set { szDisplayNameNative = value; }
}
}

[DllImport("coredll.dll", SetLastError=true)]
private static extern uint SndSetSound(SoundEvent seSoundEvent,
SoundFileInfo pSoundFileInfo, bool fSuppressUI);


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com
 
G

Guest

Changed the declaration to use "aygshell.dll" like Paul suggests and it
works on WinMo 5 emulator.

-Chris


I don't have a WinMo 6 device and I've not installed the SDKs so I don't
even have an emulator to test this code with, but it probably looks
something like what's below. The documentation isn't too helpful in
telling us what DLL it's in, so I guessed at coredll.dll. Might be
cellcore.dll if not.

// calling code:
uint ret = SndSetSound(SoundEvent.All, sfi, true);

// declaration
enum SoundEvent
{
All = 0,
RingLine1,
RingLine2,
KnownCallerLine1,
RoamingLine1,
RingVoip
}

enum SoundType
{
On = 0,
File,
Vibrate,
None
}

/*
typedef struct tagSNDFILEINFO {
TCHAR szPathName[MAX_PATH];
TCHAR szDisplayName[MAX_PATH];
SND_SOUNDTYPE sstType;
} SNDFILEINFO;
* */
class SoundFileInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szPathNameNative;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szDisplayNameNative;
public SoundType sstType;

public string szPathName
{
get { return szPathNameNative.Substring(0,
szPathNameNative.IndexOf('\0')); }
set { szPathNameNative = value; }
}

public string szDisplayName
{
get { return szDisplayNameNative.Substring(0,
szDisplayNameNative.IndexOf('\0')); }
set { szDisplayNameNative = value; }
}
}

[DllImport("coredll.dll", SetLastError=true)]
private static extern uint SndSetSound(SoundEvent seSoundEvent,
SoundFileInfo pSoundFileInfo, bool fSuppressUI);


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com




Roger Odermatt said:
Thank you very much!

Can i use this function only with C++ or is it also possible with the CF
2.0?

I hope it's possible with CF 2.0 then i don't write code with C++.

Thank you
Roger
 
G

Guest

And for the archives:

http://community.opennetcf.com/wiki/Set Ringer to Vibrate.ashx?NoRedirect=1


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


I don't have a WinMo 6 device and I've not installed the SDKs so I don't
even have an emulator to test this code with, but it probably looks
something like what's below. The documentation isn't too helpful in
telling us what DLL it's in, so I guessed at coredll.dll. Might be
cellcore.dll if not.

// calling code:
uint ret = SndSetSound(SoundEvent.All, sfi, true);

// declaration
enum SoundEvent
{
All = 0,
RingLine1,
RingLine2,
KnownCallerLine1,
RoamingLine1,
RingVoip
}

enum SoundType
{
On = 0,
File,
Vibrate,
None
}

/*
typedef struct tagSNDFILEINFO {
TCHAR szPathName[MAX_PATH];
TCHAR szDisplayName[MAX_PATH];
SND_SOUNDTYPE sstType;
} SNDFILEINFO;
* */
class SoundFileInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szPathNameNative;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szDisplayNameNative;
public SoundType sstType;

public string szPathName
{
get { return szPathNameNative.Substring(0,
szPathNameNative.IndexOf('\0')); }
set { szPathNameNative = value; }
}

public string szDisplayName
{
get { return szDisplayNameNative.Substring(0,
szDisplayNameNative.IndexOf('\0')); }
set { szDisplayNameNative = value; }
}
}

[DllImport("coredll.dll", SetLastError=true)]
private static extern uint SndSetSound(SoundEvent seSoundEvent,
SoundFileInfo pSoundFileInfo, bool fSuppressUI);


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com




Roger Odermatt said:
Thank you very much!

Can i use this function only with C++ or is it also possible with the CF
2.0?

I hope it's possible with CF 2.0 then i don't write code with C++.

Thank you
Roger
 
R

Roger Odermatt

Thank you very very much for the help.

My Problem is now, that i'm not a C# Guru, i work with VB.NET. I think it's
possible to convert this code in VB.NET but how is the right code.

I hope anybody can help me to convert the code to VB.NET.

Thank you very much
Roger

I don't have a WinMo 6 device and I've not installed the SDKs so I don't
even have an emulator to test this code with, but it probably looks
something like what's below. The documentation isn't too helpful in
telling us what DLL it's in, so I guessed at coredll.dll. Might be
cellcore.dll if not.

// calling code:
uint ret = SndSetSound(SoundEvent.All, sfi, true);

// declaration
enum SoundEvent
{
All = 0,
RingLine1,
RingLine2,
KnownCallerLine1,
RoamingLine1,
RingVoip
}

enum SoundType
{
On = 0,
File,
Vibrate,
None
}

/*
typedef struct tagSNDFILEINFO {
TCHAR szPathName[MAX_PATH];
TCHAR szDisplayName[MAX_PATH];
SND_SOUNDTYPE sstType;
} SNDFILEINFO;
* */
class SoundFileInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szPathNameNative;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szDisplayNameNative;
public SoundType sstType;

public string szPathName
{
get { return szPathNameNative.Substring(0,
szPathNameNative.IndexOf('\0')); }
set { szPathNameNative = value; }
}

public string szDisplayName
{
get { return szDisplayNameNative.Substring(0,
szDisplayNameNative.IndexOf('\0')); }
set { szDisplayNameNative = value; }
}
}

[DllImport("coredll.dll", SetLastError=true)]
private static extern uint SndSetSound(SoundEvent seSoundEvent,
SoundFileInfo pSoundFileInfo, bool fSuppressUI);


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com




Roger Odermatt said:
Thank you very much!

Can i use this function only with C++ or is it also possible with the CF
2.0?

I hope it's possible with CF 2.0 then i don't write code with C++.

Thank you
Roger
 
G

Guest

The code is very basic and doesn't require a "guru" to be able to read it.
If you plan to be a developer for the forseeable futuure then it would be
wise for you to be able to at least read other languages to some degree. It
would be a good exercise for you to convert this small bit of code and there
are online converters that can help.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


Roger Odermatt said:
Thank you very very much for the help.

My Problem is now, that i'm not a C# Guru, i work with VB.NET. I think
it's possible to convert this code in VB.NET but how is the right code.

I hope anybody can help me to convert the code to VB.NET.

Thank you very much
Roger

I don't have a WinMo 6 device and I've not installed the SDKs so I don't
even have an emulator to test this code with, but it probably looks
something like what's below. The documentation isn't too helpful in
telling us what DLL it's in, so I guessed at coredll.dll. Might be
cellcore.dll if not.

// calling code:
uint ret = SndSetSound(SoundEvent.All, sfi, true);

// declaration
enum SoundEvent
{
All = 0,
RingLine1,
RingLine2,
KnownCallerLine1,
RoamingLine1,
RingVoip
}

enum SoundType
{
On = 0,
File,
Vibrate,
None
}

/*
typedef struct tagSNDFILEINFO {
TCHAR szPathName[MAX_PATH];
TCHAR szDisplayName[MAX_PATH];
SND_SOUNDTYPE sstType;
} SNDFILEINFO;
* */
class SoundFileInfo
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szPathNameNative;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
private string szDisplayNameNative;
public SoundType sstType;

public string szPathName
{
get { return szPathNameNative.Substring(0,
szPathNameNative.IndexOf('\0')); }
set { szPathNameNative = value; }
}

public string szDisplayName
{
get { return szDisplayNameNative.Substring(0,
szDisplayNameNative.IndexOf('\0')); }
set { szDisplayNameNative = value; }
}
}

[DllImport("coredll.dll", SetLastError=true)]
private static extern uint SndSetSound(SoundEvent seSoundEvent,
SoundFileInfo pSoundFileInfo, bool fSuppressUI);


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com




Roger Odermatt said:
Thank you very much!

Can i use this function only with C++ or is it also possible with the CF
2.0?

I hope it's possible with CF 2.0 then i don't write code with C++.

Thank you
Roger

Yes, you can P/Invoke the SndSetSound function. On Professional/Classic
devices the only supported Sound Event is SND_EVENT_ALL. You can set
the Sound Type to On, Vibrate or None.
On Standard (Smartphone) devices you set the different line ringtones
separately.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility

Hello

Is it possible to change the Ringer to vibrate with WM6? When yes how
can do that?

Or is it possible to use on of the 4 Profiles on WM6? When yes, how
can change the Profiles on WM6?

Thank you very much

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top