示例#1
0
        bool RegisterForPnpEvents(IntPtr h)
        {
            PInvoke.HidD_GetHidGuid(ref HidGuid);

            DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE();

            dFilter.dbcc_size       = Marshal.SizeOf(dFilter);
            dFilter.dbcc_devicetype = gc.DBT_DEVTYP_DEVICEINTERFACE;
            dFilter.dbcc_classguid  = HidGuid;

            hDevNotification = PInvoke.RegisterDeviceNotification(h, dFilter, gc.DEVICE_NOTIFY_WINDOW_HANDLE);
            if (hDevNotification == IntPtr.Zero)
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        bool RegisterForPnpEvents(IntPtr h, Guid DrvGuid)
        {
            DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE();

            dFilter.dbcc_size       = Marshal.SizeOf(dFilter);
            dFilter.dbcc_devicetype = CyConst.DBT_DEVTYP_DEVICEINTERFACE;
            dFilter.dbcc_classguid  = DrvGuid;


            IntPtr hNotify = PInvoke.RegisterDeviceNotification(h, dFilter, CyConst.DEVICE_NOTIFY_WINDOW_HANDLE);

            if (hNotify == IntPtr.Zero)
            {
                return(false);
            }

            hDevNotifications.Add(hNotify);

            return(true);
        }
示例#3
0
        bool RegisterForPnpEvents(IntPtr h)
        {
            PInvoke.HidD_GetHidGuid(ref HidGuid);

            DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE();
            dFilter.dbcc_size = Marshal.SizeOf(dFilter);
            dFilter.dbcc_devicetype = gc.DBT_DEVTYP_DEVICEINTERFACE;
            dFilter.dbcc_classguid = HidGuid;

            hDevNotification = PInvoke.RegisterDeviceNotification(h, dFilter, gc.DEVICE_NOTIFY_WINDOW_HANDLE);
            if (hDevNotification == IntPtr.Zero) return false;

            return true;
        }
示例#4
0
 internal static extern IntPtr RegisterDeviceNotification(
     [In] IntPtr h,
     [In] DEV_BROADCAST_DEVICEINTERFACE dFilter,
     [In] uint flags);
示例#5
0
        bool RegisterForPnpEvents(IntPtr h, Guid DrvGuid)
        {
            DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE();
            dFilter.dbcc_size = Marshal.SizeOf(dFilter);
            dFilter.dbcc_devicetype = CyConst.DBT_DEVTYP_DEVICEINTERFACE;
            dFilter.dbcc_classguid = DrvGuid;

            IntPtr hNotify = PInvoke.RegisterDeviceNotification(h, dFilter, CyConst.DEVICE_NOTIFY_WINDOW_HANDLE);
            if (hNotify == IntPtr.Zero) return false;

            hDevNotifications.Add(hNotify);

            return true;
        }