Example #1
0
        /// <summary>
        /// 鼠标松开
        /// </summary>
        /// <param name="vKeyCoad"></param>
        public static void MyMouseUp(VKKey vKeyCoad)
        {
            int btScancode = 0;

            btScancode = User32Api.MapVirtualKey((byte)vKeyCoad, 0);
            KBCWait4IBE();                                          // 'wait for buffer gets empty  
                        SetPortVal(KBC_KEY_CMD, (IntPtr)0xD3, 1);   //'send write command  
                        KBCWait4IBE();

            SetPortVal(KBC_KEY_DATA, (IntPtr)(btScancode | 0x80), 1);// 'write in io  
                    
        }
Example #2
0
        /// <summary>
        /// 按键 松开
        /// </summary>
        /// <param name="vKeyCoad"></param>
        public static void MykeyUp(VKKey vKeyCoad)
        {
            if (!IsInitialize)
            {
                return;
            }

            int btScancode = 0;

            btScancode = User32Api.MapVirtualKey((uint)vKeyCoad, 0);
            KBCWait4IBE();
            SetPortVal(KBC_KEY_CMD, (IntPtr)0xD2, 1);
            KBCWait4IBE();
            SetPortVal(KBC_KEY_DATA, (IntPtr)0x60, 1);
            KBCWait4IBE();
            SetPortVal(KBC_KEY_CMD, (IntPtr)0xD2, 1);
            KBCWait4IBE();
            SetPortVal(KBC_KEY_DATA, (IntPtr)(btScancode | 0x80), 1);
        }
Example #3
0
        /// <summary>
        /// 按键按下
        /// </summary>
        /// <param name="vKeyCoad"></param>
        public static void MykeyDown(VKKey vKeyCoad)
        {
            if (!IsInitialize)
            {
                return;
            }

            Thread.Sleep(100);
            int btScancode = 0;

            btScancode = User32Api.MapVirtualKey((uint)vKeyCoad, 0);

            KBCWait4IBE();

            SetPortVal(KBC_KEY_DATA, (IntPtr)0x60, 1);

            KBCWait4IBE();

            SetPortVal(KBC_KEY_CMD, (IntPtr)0xD2, 1);

            KBCWait4IBE();

            SetPortVal(KBC_KEY_DATA, (IntPtr)btScancode, 1);
        }