Archived

This topic is now archived and is closed to further replies.

Last Attacker

c:\console help.exe

Recommended Posts

Hi! I was experimenting with the Wincon.h header (included in my project ofcource). And I managed to atleast change the titlebar of the Win32Console.
  
#include<windows.h>
#include<wincon.h>

int main()
{
     AllocConsole(); //Start console

     SetConsoleTitle("Hello!");
     FreeCosole();
     Return 0;
};
  
Thats the fearthest I came, if I tried to add the code to insert colored text, the compiler, compiled successfully but when the app. ran, windows came up with an "illegal error operation". I could''nt understand it. If anyone can propably help me, PLEASE do so! Thanks! ----------=Last Attacker=---------- ICQ: 120585863 E-mail: laextr@icqmail.com

Share this post


Link to post
Share on other sites
Did you remember to get the Console handle before trying to Set the text color?

HANDLE ConsoleHandle;
ConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(ConsoleHandle, FOREGROUND_GREEN);

Z.

Share this post


Link to post
Share on other sites