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

  • Home
  • SEARCH
  • 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 7762035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:17:19+00:00 2026-06-01T14:17:19+00:00

I am writing a small program in Visual Studio 11 (beta) that a console

  • 0

I am writing a small program in Visual Studio 11 (beta) that a console mfc app. I have never programmed for this environment before and I am trying to figure out how to detect the Escape-key press in the console. I have looked extensively at online resources and tried many different things can’t figure it out.

Here is what I was trying to see if I could get it to work.

printf("Press Escape to exit.");
bool maxReached = true;
while (maxReached)
{
    if(WM_COMMAND == IDCANCEL) // Tried many different things here, like WM_KEYDOWN == VK_ESCAPE. no luck
    {
        maxReached = false;
    }
}
exit(-1);

Any help would be much appreciated.

Kamal

  • 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-01T14:17:21+00:00Added an answer on June 1, 2026 at 2:17 pm

    You can detect using

    if (getch() == 0x1B) // escape detected
    {
      maxReached = false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to C# and Visual Studio. I'm writing a small program that
I'm writing a small proof-of-concept console program with Visual Studio 2008 and I wanted
I am writing a small program in Visual C++ 2010. This is code of
I'm writing a small program in C that will read input from the console.
I am writing a small program that gets activated when sms is received.We need
I am writing a small program in C++ using OpenCV-2.3 API. I have an
Today I am writing a small program in Haskell. I found that in ghci's
I'm writing a small JavaScript program that makes web calls to pull up weather
I am writing a small test program that gives the following xml file as
in small program I'm writing, I have to parse a line of user input.

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.