Is it possible to pause/resume the default music player from c# (maybe using the windows API)
Is there a Windows API command to pause and resume the default/current media player? If so what is it, or do I need to spoof a keyboard input somehow?
My reasoning... multimedia keyboards (or in fact almost any modern USB keyboard) have pause buttons which seem to pause most (commercial) music or video players (Windows media player, Spotify player and WinDVD all respect the command on my current windows 7 and win XP machines).
I'开发者_运维知识库m guessing the keyboard drivers aren't aware of all these apps (besides which, I haven't installed a multimedia keyboard driver in about a decade), so some standard event is being raised which the apps are respondind to? What's that event, and can I raise it (or cause it to be raised) myself from c#?
At worst there must be a standard input from the USB Human Interface Device standard? Could I spoof that?
You might consider simulating the multimedia key press event in Windows. It's not guaranteed to work for all media software, but for many it will.
These 3 items look like they may have all the pieces you'll need:
- How to simulate multimedia key press (in C)?
- pinvoke.net: sendinput (user32)
- SendInput Windows API C#
精彩评论