Well, I define a function gotoxy().

void gotoxy(int x, int y) //定位到第y行的第x列
{
    HANDLE hOutput;
    COORD loc;
    loc.X = x;
    loc.Y=y;
    hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOutput, loc);
    return;
}

However,whenever I use it.There is a flashing cursor which is ugly to see.
I want to get rid of it.But I don't know how to do it.

As I think,once the hook is closed.There is no longer a cursor.
Am I right?

I need your code associated with this problem

I don't know what you mean by saying "hook", but if you want to hide the console cursor, you can do it like this:

#include <windows.h>
#include <iostream>

int main()
{
    HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO cursor_info;

    GetConsoleCursorInfo(console, &cursor_info);

    cursor_info.bVisible = false;

    SetConsoleCursorInfo(console, &cursor_info);

    std::cout << "See? No cursor! -> ";

    Sleep(3000);
}

Useful links:

http://msdn.microsoft.com/en-us/library/ms683163(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/ms686019(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/ms682068(v=vs.85).aspx

Edited 5 Years Ago by m4ster_r0shi: n/a

I don't know what you mean by saying "hook", but if you want to hide the console cursor, you can do it like this:

#include <windows.h>
#include <iostream>

int main()
{
    HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_CURSOR_INFO cursor_info;

    GetConsoleCursorInfo(console, &cursor_info);

    cursor_info.bVisible = false;

    SetConsoleCursorInfo(console, &cursor_info);

    std::cout << "See? No cursor! -> ";

    Sleep(3000);
}

Useful links:

http://msdn.microsoft.com/en-us/library/ms683163(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/ms686019(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/ms682068(v=vs.85).aspx

Thank you master roshi,it does work.
But to make it goes to a position , we still need to use SetConsoleCursorPosition .Well , it doesn't matter for we can add the GetConsoleInfo after this function.Any way, thank you.

This question has already been answered. Start a new discussion instead.