Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
SetupDiEnumDeviceInterfaces (setupapi)
 
.
Summary
TODO - a short description

C# Signature:

[DllImport(@"setupapi.dll", CharSet=CharSet.Auto, SetLastError = true)]
public static extern Boolean SetupDiEnumDeviceInterfaces( IntPtr hDevInfo, IntPtr devInfo, ref Guid interfaceClassGuid, UInt32 memberIndex, ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData );

VB Signature:

Declare Function SetupDiEnumDeviceInterfaces Lib "setupapi.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

None.

Tips & Tricks:

//You need to create a structure for the deviceInterfaceData like this....

public struct SP_DEVICE_INTERFACE_DATA
    {
    public int cbSize;
    public Guid InterfaceClassGuid;
    public int Flags;
    public IntPtr RESERVED;
    }

//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
    {
    [DllImport(@"setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
    public static extern IntPtr SetupDiGetClassDevs(ref Guid classGuid, IntPtr enumerator, IntPtr hwndParent, UInt32 flags);
    [DllImport(@"setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
    public static extern Boolean SetupDiEnumDeviceInterfaces(IntPtr hDevInfo, IntPtr devInfo, ref Guid interfaceClassGuid, UInt32 memberIndex, ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData);

    }

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

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).

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions