Aller au contenu

How to programmatically play Screen Tap sound on Windows Mobile?

Aug 07, 2009 | 42Gears Team

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.

Subscribe for our free newsletter

Thank you! you are successfully subscribed.
newsletter

Exclusive News and Updates on Enterprise Mobility!

* I consent to receive newsletters via email from 42Gears and its Affiliates.
Please agree
* I have reviewed and agreed to 42Gears Privacy Policy and Terms of Use prior to subscribing and understand that I may change my preference or unsubscribe at any time.
Please agree
Please verify captcha
Please enter a valid official email