Created
November 5, 2013 11:29
-
-
Save davidglezz/7317732 to your computer and use it in GitHub Desktop.
Get & Set Cursor position
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> | |
int main() | |
{ | |
// GetCursorPos | |
puts("Press F8 to next example\n"); | |
POINT p; | |
while(!GetAsyncKeyState(VK_F8)) | |
{ | |
GetCursorPos(&p); | |
printf("\rX: %d\t Y: %d ",p.x, p.y); | |
Sleep(25); | |
} | |
Sleep(500); | |
// SetCursorPos to (0,0) position until you press F8. | |
//FreeConsole(); | |
puts("\rPress F8 to end\n"); | |
while(!GetAsyncKeyState(VK_F8)) | |
SetCursorPos(0,0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment