Exemplo n.º 1
0
        protected override void WndProc(ref Message message)
        {
            switch (message.Msg)
            {
            case Win32.WM_INPUT:
            {
                _keyboardDriver.ProcessRawInput(message.LParam);
                _mouseDriver.ProcessRawInput(message.LParam);
            }
            break;

            case Win32.WM_USB_DEVICECHANGE:
            {
                //0x0007 DBT_DEVNODES_CHANGED
                if ((((int)message.WParam) & 0x0007) == 0x0007)
                {
                    Debug.WriteLine("USB Device Arrival / Removal");
                    _keyboardDriver.EnumerateDevices();
                    _mouseDriver.EnumerateDevices();

                    if (DevicesChanged != null)
                    {
                        DevicesChanged(this);
                    }
                }
            }
            break;
            }
            base.WndProc(ref message);
        }
Exemplo n.º 2
0
        protected override void WndProc(ref Message message)
        {
            switch (message.Msg)
            {
            case Win32.WM_INPUT:
            {
                _mouseDriver.ProcessRawInput(message.LParam);
            }
            break;

            case Win32.WM_USB_DEVICECHANGE:
            {
                Debug.WriteLine("USB Device Arrival / Removal");
                _mouseDriver.EnumerateDevices();
            }
            break;
            }

            base.WndProc(ref message);
        }