user2780757
user2780757

Reputation: 191

Read current mouse coordinates in Windows

How does one read the current position of mouse in windows using C++ ?
I want to access the the raw data from mouse and display the coordinates.

Upvotes: 0

Views: 114

Answers (1)

David Peterson
David Peterson

Reputation: 741

Using the Windows API, you could GetCursorPos(). I can't compile the code right now to test it, but it should work out something like this:

POINT cursor;
if (GetCursorPos(&cursor)) {
    // Print out cursor.x and cursor.y
}

I'm sure you've done this, but be sure to include windows.h.

Upvotes: 2

Related Questions