更改 windows 终端上的 Carret 形状

change carret's shape on windows terminal

我想将我的控制台应用程序的文本光标(插入符号)从 BLOCK(默认)设置为 _ 或 |。

Remove blinking underscore on console / cmd prompt - but it does not mention how to modify the cursor. Documentation on https://docs.microsoft.com/en-us/windows/console/setconsolecursorinfo?redirectedfrom=MSDN对我来说不是直接琐碎的

陈峰推荐(不知道他是谁的朋友:https://devblogs.microsoft.com/oldnewthing/

这是我用于块游标的内容:

        HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);

        CONSOLE_CURSOR_INFO cursorInfo;

        GetConsoleCursorInfo(out, &cursorInfo);
        cursorInfo.bVisible = true;
        cursorInfo.dwSize = 100;
        SetConsoleCursorInfo(out, &cursorInfo);

下划线游标:

        HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);

        CONSOLE_CURSOR_INFO cursorInfo;

        GetConsoleCursorInfo(out, &cursorInfo);
        cursorInfo.bVisible = true;
        cursorInfo.dwSize = 10;
        SetConsoleCursorInfo(out, &cursorInfo);