コード例 #1
0
        void StartWndProcHandler()
        {
            IntPtr hwnd = this.Handle;

            // Connect to Raw Input & find devices
            m_3DxMouse = new _3DxMouse._3DxMouse(hwnd);
            int NumberOf3DxMice = m_3DxMouse.EnumerateDevices();

            // Setup event handlers to be called when something happens
            m_3DxMouse.MotionEvent += new _3DxMouse._3DxMouse.MotionEventHandler(MotionEvent);
            m_3DxMouse.ButtonEvent += new _3DxMouse._3DxMouse.ButtonEventHandler(ButtonEvent);

            // Add devices to device list comboBox
            foreach (System.Collections.DictionaryEntry listEntry in m_3DxMouse.deviceList)
            {
                _3DxMouse._3DxMouse.DeviceInfo devInfo = (_3DxMouse._3DxMouse.DeviceInfo)listEntry.Value;
                Debug.WriteLine("Found device: " + devInfo.deviceName);
            }
        }
コード例 #2
0
ファイル: ClientUI.cs プロジェクト: ttrask/staubliserver
        public void initPuck()
        {
            IntPtr hwnd = IntPtr.Zero;
            

            try
            {
                hwnd = this.Handle;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            //Get the Hwnd source   
            HwndSource source = HwndSource.FromHwnd(hwnd);
            //Win32 queue sink
            //source.AddHook(new HwndSourceHook(WndProc));

            // Connect to Raw Input & find devices
            my3DxMouse = new _3DxMouse._3DxMouse(hwnd);
            int NumberOf3DxMice = my3DxMouse.EnumerateDevices();

            // Setup event handlers to be called when something happens
            
            my3DxMouse.MotionEvent += new _3DxMouse._3DxMouse.MotionEventHandler(MotionEvent);
            my3DxMouse.ButtonEvent += new _3DxMouse._3DxMouse.ButtonEventHandler(ButtonEvent);

            // Add devices to device list comboBox
            foreach (System.Collections.DictionaryEntry listEntry in my3DxMouse.deviceList)
            {
                _3DxMouse._3DxMouse.DeviceInfo devInfo = (_3DxMouse._3DxMouse.DeviceInfo)listEntry.Value;
            }
            if (my3DxMouse.deviceList.Count > 0)
            {
            }

        }