예제 #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;
        }