Open arklev opened 7 months ago
Hi, I have the same problem as you, have you solved it?
Hi, I have the same problem as you, have you solved it?
Yes, i was able to make it work by setting the ENABLE_VIRTUAL_TERMINAL_PROCESSING.
Run this code before you initialize the bar.
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hOut != INVALID_HANDLE_VALUE)
{
DWORD dwOriginalOutMode = 0;
GetConsoleMode(hOut, &dwOriginalOutMode);
// Enable ANSI escape code processing
DWORD dwRequestedOutModes = dwOriginalOutMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (!SetConsoleMode(hOut, dwRequestedOutModes)) {
SetConsoleMode(hOut, dwOriginalOutMode);
}
}
Thanks, that was a great help!
The code used for this bar:
indicators::IndeterminateProgressBar bar{ indicators::option::BarWidth{40}, indicators::option::Start{"["}, indicators::option::Fill{"·"}, indicators::option::Lead{"<==>"}, indicators::option::End{"]"}, indicators::option::PostfixText{"Waiting For Mission Ready"}, indicators::option::ForegroundColor{indicators::Color::yellow}, indicators::option::FontStyles{std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}, indicators::option::Stream{std::cout} };
When running the program inside the new "Windows Terminal" it works as expected, but the CMD is not, Is it the expected result or there is some hidden option to trigger for it to work? I am on windows 10.