How to switch on/off the speaker phone in .NETCF

A few years back, I stumbled upon this article while trying to find a solution on how to switch on/off the speaker phone. It uses a DLL found in Windows Mobile 5 (and higher) devices called ossvcs.dll. This library exposes some pretty neat API’s for controlling communication related features in the device (like controlling the wireless/bluetooth radio and other cool stuff).

Here’s a quick way for switching the speaker on/off in .NETCF

[DllImport("ossvcs.dll", EntryPoint = "#218")]        
static extern int SetSpeakerMode(uint mode);
 
void EnableSpeakerPhone()
{
    SetSpeakerMode(1);
}
 
void DisableSpeakerPhone()
{
    SetSpeakerMode(0);
}

Unfortunately, ossvcs.dll is not documented and might not exist in the future. But for now, it pretty much works in all devices I’ve tried

Leave a Reply

Your email address will not be published. Required fields are marked *