key combination c# other than hotkeys

I am implementing shortcut key combination logic like

Ctrl + A

Ctrl + Alt + D

but now I am looking for a trick to implement keyboard key combination without hotkey combination like : A + D but not getting any right things.

So please help to implement it.


Currently I am not able to add key combination other than hotkey combination.because whenever I am pressing two keys like : **A + D** it returns only single keys ascii so I am not getting two keys combination.

I have used following stuff


In the past I used the GetKeyState Api (inside a similar class for catching system wide shortcuts). Perhaps new variants are available nowadays (WPF has a KeyBoard.IsKeyDown I believe), but this should still work:

    [DllImport("user32", CharSet = CharSet.Auto,
    ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]
    static extern short GetKeyState(int keyCode);

    public static bool CheckKeysPressed(params Keys[] keys)
        for (int i = 0; i < keys.Length; i++)
            if (!CheckKeyPressed((int)keys[i])) return false;
        return true;
    public static bool CheckKeyPressed(Keys key)
        return CheckKeyPressed((int)key);
    public static bool CheckKeyPressed(int vkey)
        short ks = GetKeyState(vkey);
        return ks == 1;

Usage: if(CheckKeysPressed(Keys.A, Keys.D)) {/*...*/}

Declare 2 bool variable (say IsADown and IsDDown) and "true" them on events of both A and D. Also detect on both events if other bool is down or not. If it is, then do what you have to do with both button pressed.

Need Your Help

Replace one image with another after clicking a button

android android-image

I have defined an image in my xml file (imageview). I'd like to change it to another image after clicking a button in my activity. How can I do that?

Apache POI 3.9 can not get HSSFPalette

java excel apache-poi palette

I am using apache poi 3.9. I need to have a custom color in my excel.