或许可以查询注册表看看 HKCU\CONSOLE 下有无 VirtualTerminalLevel 这个值
还有官网抄了段C代码,不知行否 (建议用msvc和1803以上的sdk编译)
运行后返回值0表示支持,1不支持,其他值出错- #include <stdio.h>
- #include <wchar.h>
- #include <windows.h>
-
- /*
- https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences
- */
-
- int main()
- {
- // Set output mode to handle virtual terminal sequences
- HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
- if (hOut == INVALID_HANDLE_VALUE)
- {
- return 3;
- }
-
- DWORD dwMode = 0;
- if (!GetConsoleMode(hOut, &dwMode))
- {
- return 2;
- }
-
- dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
- if (!SetConsoleMode(hOut, dwMode))
- {
- return 1;
- }
-
- return 0;
- }
复制代码
|