Exemplo n.º 1
0
        static bool GetPort(IO_Ports port)
        {
            switch (port)
            {
            case IO_Ports.CAPS: return(CAPS_STATE);

            case IO_Ports.NUMLOCK: return(NUM_STATE);

            case IO_Ports.SCROLL: return(SCROLL_STATE);

            default: return(false);
            }
        }
Exemplo n.º 2
0
        // =======================================================================

        static void PressKey(IO_Ports port)
        {
            switch (port)
            {
            case IO_Ports.CAPS:
                keybd_event(VK_CAPS, 0, KEY_DOWN, 0);
                keybd_event(VK_CAPS, 0, KEY_UP, 0);
                break;

            case IO_Ports.NUMLOCK:
                keybd_event(VK_NUMLOCK, 0, KEY_DOWN, 0);
                keybd_event(VK_NUMLOCK, 0, KEY_UP, 0);
                break;

            case IO_Ports.SCROLL:
                keybd_event(VK_SCROLL, 0, KEY_DOWN, 0);
                keybd_event(VK_SCROLL, 0, KEY_UP, 0);
                break;
            }
        }
Exemplo n.º 3
0
        public static void SetPort(IO_Ports port, bool state)
        {
            // CAPS
            if (port == IO_Ports.CAPS)
            {
                if (CAPS_STATE)
                {
                    if (state == false)
                    {
                        CAPS_STATE = false;
                        PressKey(port);
                    }
                }
                else
                {
                    if (state)
                    {
                        CAPS_STATE = true;
                        PressKey(port);
                    }
                }
            }

            // NUM
            if (port == IO_Ports.NUMLOCK)
            {
                if (NUM_STATE)
                {
                    if (state == false)
                    {
                        NUM_STATE = false;
                        PressKey(port);
                    }
                }
                else
                {
                    if (state)
                    {
                        NUM_STATE = true;
                        PressKey(port);
                    }
                }
            }

            // SCROLL
            if (port == IO_Ports.SCROLL)
            {
                if (SCROLL_STATE)
                {
                    if (state == false)
                    {
                        SCROLL_STATE = false;
                        PressKey(port);
                    }
                }
                else
                {
                    if (state)
                    {
                        SCROLL_STATE = true;
                        PressKey(port);
                    }
                }
            }
        }