• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

ActiveX control ALT+DOWN arrow key processing

I'm writing an ActiveX control. I must process the ALT+DOWN key combination. Anybody knows how to do it?

I can receive the ALT key in the OnSysKeyDown() message. Also, i can receive the VK_DOWN message by doing the following:

BOOL CNMComboBoxCtrl::PreTranslateMessage(MSG* lpmsg)
{
    BOOL bHandleNow = FALSE;

    switch (lpmsg->message)
    {
            case WM_KEYDOWN:
              switch (lpmsg->wParam)
                {
                        case VK_DOWN:
                                    bHandleNow = TRUE;
                            break;

break;
                  }
            if (bHandleNow)
            OnKeyDown(lpmsg->wParam, LOWORD(lpmsg
                ->lParam), HIWORD(lpmsg->lParam));
        break;
    }

      return bHandleNow;
      
      return COleControl::PreTranslateMessage(lpmsg);
}

This way i get the DOWN key in the OnKeyDown message.

If i press the DOWN key while holding the ALT key, i do not get the DOWN message in the OnKeyDown. It's handled anywhere else.

So i have the problem of handling this key combination. I'll be very thankful for your help.
0
Mindo
Asked:
Mindo
  • 4
  • 3
1 Solution
 
SteveGTRCommented:
Try this:


if (lpmsg->message == WM_SYSKEYDOWN)
  {
  if ((lpmsg->wParam == VK_DOWN && GetKeyState(VK_MENU) & 0x8000) ||
      (lpmsg->wParam == VK_MENU && GetKeyState(VK_DOWN) & 0x8000))
    MessageBox("ALT-VK_DOWN pressed");

Good luck,
Steve


0
 
MindoAuthor Commented:
Thanks, man, it works. Tell me, how do you learn these things? Win32 is still a pain in the butt for me :-)
0
 
SteveGTRCommented:
I find that searching the MFC code is a great source of finding out how things work. It helps to know sort of what to look for, but you develop that over time.
0
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
MindoAuthor Commented:
You mean you're reading the Microsoft MFC source code? Is it freely available? Hmm, i haven't found how the CEdit control is drawn. Tell me if you have it's source code.
0
 
SteveGTRCommented:
They give it to you when you buy VC++.

\Program Files\Microsoft Visual Studio\VC98\MFC\SRC

  - and -

\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE

I do text searches for what I'm interested in using "findstr" on NT in a DOS box.
0
 
MindoAuthor Commented:
Of course, i know this source directory. Unfortunately, i haven't found how the CEdit is drawn. This source is incomplete!
0
 
SteveGTRCommented:
Well, you are right about that.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now