Note that there are some explanatory texts on larger screens.

plurals
  1. POWin32 API function to programmatically enable/disable device
    text
    copied!<p>I am writing a small C# app to disable a device (my laptop touchpad) whenever another mouse device is detected, and enable the touchpad again if a mouse is not detected. I am not even able to disable the touchpad in device manager (it is running on the default mouse class driver). </p> <p>I am getting into device driver development so I thought maybe I could write a little filter driver that would just accept IOCTLs to enable and disable passing mouse event messages up the device stack, and get messages from user mode via a raw PDO. However, <a href="https://stackoverflow.com/questions/1430798/raw-pdo-to-send-ioctl-to-upper-filter-driver-kbfiltr-moufiltr-to-enable-disable">I asked that question</a> and somebody has suggested that I can do this in usermode via the <a href="http://msdn.microsoft.com/en-us/library/ms791137.aspx" rel="nofollow noreferrer"><em>SetupDi..</em></a> functions. That would be really good, because this raw PDO communication method is a PITA to work with.</p> <p>I have only used <em>SetupDiGetClassDevs</em> before, and there are so many of them, can someone with more experience with this part of the Win32 API just tell me quickly what one I should call to stop/disable a mouse device or its interface or if there is something somewhere in the dark corners of the framework that will do this (maybe in WMI?).</p> <p><strong>Update (24/9/09)</strong> I figured out how to do this with a filter driver and posted how I did it on <a href="https://stackoverflow.com/questions/1430798/raw-pdo-to-send-ioctl-to-upper-filter-driver-kbfiltr-moufiltr-to-enable-disable">my original question</a>. I still want to know if it is possible to enable or disable devices directly from Win32 and if so, how - so I will leave this question open.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload