示例#1
0
 void ReHIDUI()
 {
     if (HIDDevice.TheHIDDevice == null)
     {
         HIDDevice.TheHIDDevice = HIDDevice.FindDevice();
     }
     HIDUI();
 }
示例#2
0
        protected override void WndProc(ref Message m)
        {
            try
            {
                if (m.Msg == 0x0219)
                {
                    switch (m.WParam.ToInt32())
                    {
                    case 0x8000:
                        if (HIDDevice.TheHIDDevice == null)
                        {
                            HIDDevice.TheHIDDevice = HIDDevice.FindDevice();
                        }
                        HIDUI();
                        break;

                    case 0x8004:
                        try
                        {
                            HIDDevice.TheHIDDevice.Dispose();
                            HIDDevice.TheHIDDevice = null;
                        }
                        catch { }
                        HIDUI();
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            base.WndProc(ref m);
        }