SetupDiGetClassDevs() private method

private SetupDiGetClassDevs ( System.Guid &classGuid, int enumerator, IntPtr hwndParent, int flags ) : IntPtr
classGuid System.Guid
enumerator int
hwndParent System.IntPtr
flags int
return System.IntPtr
Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the DeviceClass class.
        /// </summary>
        /// <param name="classGuid">A device class Guid.</param>
        /// <param name="hwndParent">The handle of the top-level window to be used for any user interface or IntPtr.Zero for no handle.</param>
        protected DeviceClass(Guid classGuid, IntPtr hwndParent)
        {
            _classGuid = classGuid;

            _deviceInfoSet = Native.SetupDiGetClassDevs(ref _classGuid, 0, hwndParent, Native.DIGCF_DEVICEINTERFACE | Native.DIGCF_PRESENT);
            if (_deviceInfoSet.ToInt32() == Native.INVALID_HANDLE_VALUE)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
        }