Jump to content

Program function (or other) keys to play sounds on demand

Featured Replies

I have an old Dell (Vista) laptop I'm using for controlling things in a play and am trying to get a handful of keys to play particular sound files on demand, without leaving the Powerpoint screen.

 

Any ideas welcome.

 

Already tried Intellitype, but can't seem to access the keys, let alone reprogram them.

What you need is application allowing reconfiguration of hot keys to execute some command-line tool.

 

And command-line tool to play the sound, supplied as argument, path to .wav or .mp3 file.

 

Personally I would not even bother searching for such apps (it would take longer), but simply make them.

 

Try PlaySound function

https://msdn.microsoft.com/en-us/library/windows/desktop/dd743680(v=vs.85).aspx

https://msdn.microsoft.com/pl-pl/library/windows/desktop/dd743679(v=vs.85).aspx

Here is Visual Studio 2008 Express project with compiled 32 bit exe:

PlaySound.zip

(only one argument, path to .wave file)

 

To intercept keys use SetWindowsHookEx

https://msdn.microsoft.com/pl-pl/library/windows/desktop/ms644990(v=vs.85).aspx

with WH_KEYBOARD or WH_KEYBOARD_LL

 

Here is Visual Studio 2008 Express project with compiled 32 bit exe and DLL with hook routine:

HotKeySound.zip

After pressing keys 0....9 there will be played sound with path C:\0.wav .... C:\9.wav, so you have to rename your files to match them.

You can change this inside of DLL routine MyHookProc.

I was wondering whether Windows will allow using PlaySound (or even loading file at such low level function).

But works fine in at least Windows 7 and Windows XP.

Edited by Sensei

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.