views:

36

answers:

2

Is it possible to change the background color and the title text of compiled command line program ?
I do not have the source files.

+1  A: 

If 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.

Robin
Thanks for your answer.
T1000
The Windows console as well as the programms running in it are totally different things. Also it's not command.com what you're referring to (I hope), but cmd.exe
Joey
+1  A: 

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);
Jesse Collins