Desktop Functions: Smart Device Functions:
|
SetupDiEnumDeviceInterfaces (setupapi)
C# Signature:
[DllImport(@"setupapi.dll", CharSet=CharSet.Auto, SetLastError = true)] VB Signature:
Declare Function SetupDiEnumDeviceInterfaces Lib "setupapi.dll" (TODO) As TODO User-Defined Types:None. Notes:A call to SetupDiEnumDeviceInterfaces retrieves a pointer to a structure that identifies a specific device interface in the previously retrieved DeviceInfoSet array. The call specifies a device interface by passing an array index. To retrieve information about all of the device interfaces, an application can loop through the array, incrementing the array index until the function returns zero, indicating that there are no more interfaces. The GetLastError API function then returns No more data is available. Tips & Tricks:
[StructLayout(LayoutKind.Sequential)] //You need to create a structure for the deviceInterfaceData like this....
public struct SP_DEVICE_INTERFACE_DATA //Then initialize the cbSize value like this in your calling method SP_DEVICE_INTERFACE_DATA devData = new SP_DEVICE_INTERFACE_DATA(); devData.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(devData); // failure to do so will always return false (which is the value you'll also get if the device is not connected) // Here's what the call looks like... bool result = Win32Calls.SetupDiEnumDeviceInterfaces(ipDeviceHndl, iLU, ref DeviceGUID, 0, ref devData); // The DeviceGUID parameter will be device dependant. Look in the Manufacturer's sdk or api for the correct guid for your device Sample Code:
class Win32Calls Please edit this page!Do you have...
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more). |
|