예제 #1
0
        //InputSimulator inps;

        protected override void WndProc(ref Message message)
        {
            switch (message.Msg)
            {
            case WM_HOTKEY:
                Keys         key      = (Keys)(((int)message.LParam >> 16) & 0xFFFF);
                KeyModifiers modifier = (KeyModifiers)((int)message.LParam & 0xFFFF);
                //MessageBox.Show("HotKey Pressed :" + modifier.ToString() + " " + key.ToString());

                if ((userKeyModifiers1) == modifier && userKey1 == key)
                {
                    // Send Alt-Tab
                    SendKeys.Send("%{Tab}");
                    //ShowToolTip(this, "Show Alt+Tab Window");
                }

                if ((userKeyModifiers2) == modifier && userKey2 == key)
                {
                    ToggleKey(VK_HANGULE);
                    //ShowToolTip(this, "Switch IME (Han/Eng)");
                }

                if ((userKeyModifiers3) == modifier && userKey3 == key)
                {
                    // Send {Control down}{LWin down}{Left}{Control up}{LWin up}
                    KeyboardSend.KeyDown(VK_LCONTROL);
                    KeyboardSend.KeyDown(VK_LWIN);
                    KeyboardSend.KeyDown(VK_LEFT);
                    KeyboardSend.KeyUp(VK_LCONTROL);
                    KeyboardSend.KeyUp(VK_LWIN);
                    KeyboardSend.KeyUp(VK_LEFT);
                    //ShowToolTip(this, "Move Virtual Desktop to LEFT");

                    //MessageBox.Show("");
                }

                if ((userKeyModifiers4) == modifier && userKey4 == key)
                {
                    // Send {Control down}{LWin down}{Left}{Control up}{LWin up}
                    KeyboardSend.KeyDown(VK_LCONTROL);
                    KeyboardSend.KeyDown(VK_LWIN);
                    KeyboardSend.KeyDown(VK_RIGHT);
                    KeyboardSend.KeyUp(VK_LCONTROL);
                    KeyboardSend.KeyUp(VK_LWIN);
                    KeyboardSend.KeyUp(VK_RIGHT);
                    //ShowToolTip(this, "Move Virtual Desktop to RIGHT");

                    //MessageBox.Show("");
                }

                if ((userKeyModifiers5) == modifier && userKey5 == key)
                {
                    RunFileDlg(IntPtr.Zero, IntPtr.Zero, null, null, null, 0);
                }

                break;
            }
            base.WndProc(ref message);
        }
예제 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     //SendKeys.Send("%{Tab}");
     //ToggleKey(VK_LWIN);
     KeyboardSend.KeyDown(VK_LCONTROL);
     KeyboardSend.KeyDown(VK_LWIN);
     KeyboardSend.KeyDown(VK_RIGHT);
     KeyboardSend.KeyUp(VK_LCONTROL);
     KeyboardSend.KeyUp(VK_LWIN);
     KeyboardSend.KeyUp(VK_RIGHT);
 }
예제 #3
0
 void ToggleKey(int key)
 {
     KeyboardSend.KeyDown(key);
     KeyboardSend.KeyUp(key);
 }