3

I'm using the code from this answer: Win32 API function to programmatically enable/disable device

The code works, but sort of. It only succesfully enables the device if it has previously been disabled by the same code. If the device is "disabled" before the program starts, it can not successfully enable it, but it doesn't throw any exceptions. The code runs normally, I see a "refresh" in my device manager, but it's still disabled.

Only when I manually enable the device first, the code can successfully disable and enable it. Is there any way to properly use this excellent piece of code in a way that starts with a disabled device?

It's probably something small, but I can't see it.

Community
  • 1
  • 1
Davio
  • 4,609
  • 2
  • 31
  • 58
  • maybe this older [topic](http://stackoverflow.com/questions/1438371/win32-api-function-to-programatically-enable-disable-device) could help you – CuccoChaser Nov 14 '12 at 09:18
  • @FlorisPrijt I already saw that, I linked to it myself, but that's exactly the code I'm having problems with. – Davio Nov 14 '12 at 09:23
  • Ah I missed that link there, my bad. I am afraid I do not have any experience with the subject itself, so best of luck. Hope you'll find an answer somewhere. – CuccoChaser Nov 14 '12 at 09:25

0 Answers0