// }}} // DEVICE INPUT EVENTS public bool registerWindowForEvents() // {{{ { // Accessing DX1 device // Called by DX1Utility.Constructor if (DX1Utility.Debug) { log("Device.registerWindowForEvents(" + this.formHandle + ")"); } // And register for the actual event DEV_BROADCAST_DEVICEHANDLE devHandle = new DEV_BROADCAST_DEVICEHANDLE(); devHandle.dbch_size = (uint)Marshal.SizeOf(devHandle); devHandle.dbch_devicetype = 6; devHandle.dcbh_handle = dx1Handle; devHandle.dcbh_hdevnotify = IntPtr.Zero; devHandle.dcbh_eventguid = new Guid(DX1_GUID); IntPtr not2 = NativeMethods.RegisterDeviceNotification(this.formHandle, ref devHandle, 0); return(not2 != IntPtr.Zero); }
public static extern IntPtr RegisterDeviceNotification(IntPtr hRecipient , ref DEV_BROADCAST_DEVICEHANDLE NotificationFilter , uint Flags);