示例#1
0
        public SynapticsMouse(int deviceHandle)
        {
            if (-1 == deviceHandle)
            {
                throw new Exception();
            }

            this.synDeviceCtrl.Select(deviceHandle);

            string hardwareID = synDeviceCtrl.GetStringProperty((SynDeviceProperty)SynDeviceStringProperty.SP_PnPID);

            Debug.Print("SynapticsMouse HardwareID={0}", hardwareID);
            string[] token = hardwareID.Split(new char[] { '&' });
            this.VendorID = token[0];
            this.DeviceID = token[1];

            this.Name = synDeviceCtrl.GetStringProperty((SynDeviceProperty)SynDeviceStringProperty.SP_ModelString);
            Debug.Print("Device name={0}", this.Name);

            this.synDeviceCtrl.Activate();
            this.synDeviceCtrl.OnPacket += new _ISynDeviceCtrlEvents_OnPacketEventHandler(OnPacket);
        }