How to detect headphones plug unplug through audio jack RRS feed

  • Question

  • Hi, 

    I need to create a functionality in my application which detect headphones plug and unplug through audio jack. Is there anyway for me to do it through WMI ? I try to look at Win32_USBHub , Win32_PortConnector but no luck. Any help appreciated. Thanks 

    Friday, December 28, 2012 6:02 AM


All replies

  • If Windows is Vista or later you can use device arrival notifications, see Registering For Device Notifications. That's C++, but maybe you can find sample in C# with Google if there is one.

    • Marked as answer by Bob Shen Friday, January 4, 2013 4:57 AM
    Friday, December 28, 2012 6:23 AM
  • Thanks for this but how to find the GUID for the headphone also i want to be able to detect audio jack plug/unplug regardless which model of headphones. Do anyone know about the WMI way to do it ? I try to use win32_portconnector and the win32_usbhub but both of them doesn't detect audio jack plug/unplug. Thanks 
    Sunday, December 30, 2012 11:03 PM
  • Only services need to Registering For Device Notifications.  Override WndProc to ckeck for notification in a WF app.
    • Marked as answer by Bob Shen Friday, January 4, 2013 4:57 AM
    Sunday, December 30, 2012 11:52 PM