How to programmatically play Screen Tap sound on Windows Mobile?

Lots of sounds that we hear when using Windows Mobile and Windows CE devices are generated by the OS by playing wav files. They are located in Windows folder. You can use them in your program with a call to PlaySound API.

But the sound played when screen is tapped is not a wav file. Looking through Windows CE source code, I found that during OS image building two wave files tchsoft.wav and tchloud.wav are embedded into a waveapi.dll as resources. Following is the code snippet to play the soft and loud Screen Tap sounds.

#define ID_WAVE_TCHLOUD 102
#define ID_WAVE_TCHSOFT 103

HMODULE hModule = LoadLibrary(L”waveapi.dll”);
PlaySound(MAKEINTRESOURCE(ID_WAVE_TCHSOFT), hModule, SND_RESOURCE);
PlaySound(MAKEINTRESOURCE(ID_WAVE_TCHLOUD), hModule, SND_RESOURCE);
FreeLibrary(hModule);

Note: The identifier values or the logic might change in future, so be careful to test it. In any case you can look through CE source code to know the latest implementation.

I hope many people will find this useful.

Leave a Comment