none
Press combination key at the same time RRS feed

  • Question

  • Hi,

    In our product (ADR), when press the combination key (shift + key, ctrl + key, shift + ctrl + key...) at the same time, always only the single key shift/ctrl/key will take effect. I test the Word, Paint, Notepad with Ctrl+v, ctrl+z, issue exists too.

    Is there a solution for the issue?

    Thanks,
    Silvia
    • Moved by eryang Monday, December 21, 2009 2:17 AM (From:.NET Base Class Library)
    Monday, December 14, 2009 9:04 AM

All replies

  • Hi Silvia,

    I tested in a form with keydown event, any combination of your point can be captured.
    protected override void OnKeyDown(KeyEventArgs e)
            {
                base.OnKeyDown(e);

                if (e.KeyCode == Keys.A)
                {
                    if (e.Shift)
                    {
                        if (e.Control)
                        {
                            Console.WriteLine("Shift + Ctrl + A");
                        }
                        else
                        {
                            Console.WriteLine("Shift + A");
                        }
                    }
                    else
                    {
                        if (e.Control)
                        {
                            Console.WriteLine("Ctrl + A");
                        }
                        else
                        {
                            Console.WriteLine("A");
                        }
                    }
                }
            }

    Monday, December 14, 2009 10:20 AM
  • GetAsyncKeyState API function might help you

    http://msdn.microsoft.com/en-us/library/ms646293(VS.85).aspx
    Gaurav Khanna
    Monday, December 14, 2009 10:20 AM
  • Thank you for your reply.

    Yes, you sample can get the combination key. But our project cannot.
    We create a ATL control and define the combination key for command, and ATL window calls

    CWindowImplBaseT::ProcessWindowMessage; then our control handle the message.
    This is a very simple solution.

     



    Silvia

    Tuesday, December 15, 2009 9:01 AM
  • Hi Silvia,

    Thanks for your post, but you can consider posting the question in following more appropriate forums for quicker and better support: http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/threads


    Sincerely,
    Eric

    Please remember to mark helpful replies as answers.
    Monday, December 21, 2009 2:17 AM