SetupDiRemoveDevice
// Get all of the devices //This enumeration does not work in general, instead passing //complete id of the device is probably best. //It is helpful to know the vendor and device ID PCTSTR enumType = "PORTS"; HDEVINFO devs = NULL; devs = SetupDiGetClassDevs(NULL,enumType,0,DIGCF_ALLCLASSES); // Loop through the devices DWORD devCount = 0; SP_DEVINFO_DATA devInfo; int enumeratingDevices = 1; /*This line is essential*/ devInfo.cbSize = sizeof(SP_DEVINFO_DATA); while(enumeratingDevices){ enumeratingDevices = SetupDiEnumDeviceInfo (devs,devCount,&devInfo); // Uninstall each device if(enumeratingDevices){ SetupDiRemoveDevice(devs,&devInfo); devCount++; } } //Clean up SetupDiDestroyDeviceInfoList(devs); What I have tried: <pre>I have Disabled USB drive successfully after i tried Enable the Usb again
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)