Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:02:49+00:00 2026-06-15T07:02:49+00:00

Ive been struggling for a while with a basic UI thing. I have a

  • 0

Ive been struggling for a while with a basic UI thing. I have a parent window and several child windows. With child windows such as button (BS_CHECKBOX style) and edit Im not able to process any message for pressing the ESC key event. I could subclass child windows but it seems to be an overkill just to handle one event. I also have a listview child and for some reason I can handle the VK_ESCAPE correctly. I also checked spy++ and noticed there are NO messages sent to the parent window when ESC key is pressed (and the child is focused). If I set spy++ to log child messages only, the correct messages are generated for the key press – they are just not passed to the parent. Any ideas what (not) to do?

Main window loop:

  MSG Msg;
  while (GetMessage(&Msg, NULL, 0, 0))
  {
    TranslateMessage (&Msg);
    DispatchMessage (&Msg);
  }

Working code in parent’s WndProc for handling listview key press:

case WM_NOTIFY:
    switch (((LPNMHDR)lParam)->code)
    {
    case LVN_KEYDOWN:
        if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_ESCAPE)
            Exit();
        break;
    }
    break;

Thanks,

Kra

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:02:50+00:00Added an answer on June 15, 2026 at 7:02 am

    One way to do this is to catch it in your message loop before it gets dispatched to the focus window, e.g.:

    MSG Msg;
    while (GetMessage(&Msg, NULL, 0, 0))
    {
        if (Msg.message == WM_KEYDOWN && Msg.wParam == VK_ESCAPE)
        {
            // process escape key
        }
        else
        {
            TranslateMessage(&Msg);
            DispatchMessage(&Msg);
        }
    }
    

    There are other ways to do it of course, but this is a very simple solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been struggling with this for a while. Basically, I want to have two
I've been struggling with this issue for a little while now. Found several posts
I've been struggling with this issue for a while now. I have OpenCart 1.5.2.1
I've been struggling with some weird thing about php for a while. It seems
Ive been struggling for a while with my rather simple app. This is my
I've been struggling with this for a while. Presently, I have a grid of
ive been struggling with this for a while. its taking over 12 seconds and
I've been struggling with this for a while and have yet to find an
i've been struggling for a while trying to have the rotate(xdeg) feature on IE
I've been struggling with div alignments for a while. I have one pop-up in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.