Error :Unable to load DLL (Setupapi.lib)
In my C# code:
public class Win32
{
......
[DllImport("Setupapi.lib", CharSet=CharSet.Auto)]
public static extern IntPtr SetupDiGetClassDevs(
[In]System.Guid ClassGuid,
[In]string Enumerator,
[In]IntPtr hwndParent,
[In]int Flags
);
......
}
public class usbdevice
{
......
hDevInfo = Win32.SetupDiGetClassDevs(Win32.GUID_DEVINTERFACE_USB_DEVICE, //usb class GUID
null, // Enumerator
......
}
when invoke the SetupDiGetClassDevs(),a error occurs,it says:
"An unhandled exception of type 'System.DllNotFoundException' occured in usbdevice.exe"
"Additionas information:Unable to loas DLL (Setupapi.lib)".
what's the problem?
Thanks!
new IntPtr(null),
Win32.DIGCF_PRESENT | Win32.DIGCF_DEVICEINTERFACE); //flags