Is it possible to change the background color and the title text of compiled command line program ?
I do not have the source files.
views:
36answers:
2If it is an app that simply runs on the cli without using external libraries such as ncurses, it should be fairly easy. To do so you just have to change the color of your terminal.
As with the standard command.com terminal which is around since the first version of windows I believe, you just have to use google. There are plenty of search results such as http://www.daniweb.com/forums/thread15790.html. With the new windows power shell, included in windows seven, the solution should be identical.
If the application uses a library like ncurses, you won't be able to change the colors without reverse engineering.
If you need to do it after the target program is already running, you can set the title and color of that console from another process:
::FreeConsole();
::AttachConsole(pidOfTarget);
::SetConsoleTitle(_T("aaaaaaaaaaa"));
::SetConsoleTextAttribute(
::GetStdHandle(STD_OUTPUT_HANDLE),
BACKGROUND_BLUE | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);