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 6011871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:19:19+00:00 2026-05-23T02:19:19+00:00

How can I get the mouse click position in C++ in a Windows console

  • 0

How can I get the mouse click position in C++ in a Windows console program? (A variable that returns the position of the mouse when clicked)

I want to draw a menu with simple text commands, so when someone clicks, the game will register it and know the position. I know how to do everything I need to do except get the mouse position when clicked.

  • 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-05-23T02:19:20+00:00Added an answer on May 23, 2026 at 2:19 am

    You’ll need to use the *ConsoleInput family of methods (peek, read, etc). These operate on the console’s input buffer, which includes keyboard and mouse events. The general strategy is:

    1. wait on the console’s input buffer handle (ReadConsoleInput)
    2. determine the number of waiting events (lpNumberOfEventsRead)
    3. handle them as you see fit (i.e. MOUSE_EVENT and MOUSE_EVENT_RECORD)

    You’ll have to indicate that you want to retrieve mouse input using SetConsoleMode first though, as illustrated in this MSDN article.

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

Sidebar

Related Questions

In C++ (WIN32), how can I get the (X,y) coordinate of a mouse click
I need to get the position of the mouse on click in a form,
How can get a row's value on mouse click or checking the checkbox preferably
I want to get the exact instance of XYDataItem when a mouse click makes
How can I get a UIElement to ignore mouse clicks on it and pass
Logging can get complicated, quickly. Considering that you have some code, how do you
I CAN get the associated icon just fine, and draw it accordingly, however, I
I added a mouse clicked listner to my jtable, when i double click the
I am trying to get the absolute position (top and left) of a mouse
I have an image that I draw on a canvas. When the mouse clicks

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.