Reputation: 5242
I've a digital mike with buttons like play,pause,stop. I can "listen" the events on these buttons by using it's SDK. But I want to use these buttons on a web page.
In my webpage, I can "listen" the multimedia keyboard keys like play,pause, and stop. So I want to map the mike buttons so that pressing the button actually creates an event created by corresponding key on the keyboard.
For example, If I press "pause" button on my USB mike, the keyboard "pause button" event should be triggered. How can I achieve this? and will I have to create a windows service for this?
Upvotes: 2
Views: 1387
Reputation: 108810
I'd look into the SendInput
function.
Or alternatively the older and simpler keybd_event
.
While MS recommends using SendInput
, I'd probably use keybd_event
because the native interop for it looks a lot easier. To me it looks like the main advantage of SendInput
is that it supports multiple inputs within a single call. But you don't need that anyways.
Upvotes: 1
Reputation: 1442
read up on windows hooks.They can be used to simulate keyboard events etc. Most of the code is in c++ but I am sure you can find libraries that provider wrappers for these functions in C#
Upvotes: 0