3

I want to develop a C#/.NET application that detects when headphones are plugged in, and unplugged. I want to log these events to a file, so I can discover and note when someone steals headphones from one of the (100 or so) systems that I manage.

How can I detect when headphones are plugged in, and unplugged?

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
  • You realize you'll only be able to log systems where the software installed I assume? I am also going to assume this is software for a lab scenario where multiple users may be borrowing others' equipment? – Brad Christie Jul 27 '13 at 17:32
  • BTW, see also http://stackoverflow.com/questions/5526998/detect-headphones-in-windows & http://stackoverflow.com/questions/861601/detecting-when-head-phones-are-plugged-in – Brad Christie Jul 27 '13 at 17:32
  • "and puts in their own systems" - Are you talking about a *specific* set of headphones there that you want to recognize once they have been plugged in? And by "in their own system", you mean a thief's computer that you do not have any access to, and who certainly has no interest in installing your theft detection software? – O. R. Mapper Jul 27 '13 at 17:35
  • user2626050, I've (fairly dramatically) edited your question, trying to focus it on the matter at hand. Please review, and make further changes and clarifications as needed. Note that this site prefers to focus on specific issues - we won't write this tool for you (it kinda sounded like you were asking for that), but we can help with questions like, "how can I learn when a device is unplugged?" – Michael Petrotta Jul 27 '13 at 17:40
  • Interesting question though. The software should be actively monitoring for hardware changes? Or is the soundcard responsible for detecting plugged peripherals? – Recipe Jul 27 '13 at 17:59
  • You could have a look at Microsoft.DirectX.DirectSound.Device().SpeakerConf – BradW Jul 27 '13 at 18:28

0 Answers0