how can i control the cursor???
hi , i've aquestion , how can i place the cursor of input where i want
to input in a specific destination on the screen;
thanks
Here is a small program I put together that moves the cursor to position 10,10 on the screen. You can modify it to move the cursor where you want.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream.h>
#include <stdlib.h>
#include <windows.h>
void curPos(int, int);
int main()
{
system("CLS");
curPos(10,10);
cout << "10,10" << endl;
system("PAUSE");
return 0;
}
void curPos(int x, int y) {
HANDLE hStdout;
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
hStdout=GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hStdout, &csbiInfo);
csbiInfo.dwCursorPosition.X=x;
csbiInfo.dwCursorPosition.Y=y;
SetConsoleCursorPosition(hStdout, csbiInfo.dwCursorPosition);
}
|
Last edited on
Topic archived. No new replies allowed.