![]() |
|
[C] C++ - Changing CMD background colour? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] C++ - Changing CMD background colour? (/showthread.php?tid=5225250) |
C++ - Changing CMD background colour? - Cough - Apr 3, 2016 Not the text background but the actual whole console My compiler is VS I don't know if the system function has it, but I'd rather not use it I've been looking everywhere I can :P * - Remix - Apr 3, 2016 http://ss64.com/nt/color.html Just use the system() function for it. Example: Code system("COLOR 83");* - Cough - Apr 3, 2016 (Apr 3, 2016 09:40 AM)Teh Remix Wrote: http://ss64.com/nt/color.html Alright, read some posts on text colouring and some guy said system is bad and shouldn't be used - it's not the way to learn C++ * - Remix - Apr 3, 2016 (Apr 3, 2016 10:09 AM)Wonga Wrote: Alright, read some posts on text colouring and some guy said system is bad and shouldn't be used - it's not the way to learn C++ Why don't you ask that guy how to do it then? Or why didn't he explained it? Well. Sure, the system function is shit but for basic coloring it's not that bad. Anyways maybe you want to use the windows api: Code HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);* - Cough - Apr 3, 2016 (Apr 3, 2016 10:18 AM)Teh Remix Wrote: Why don't you ask that guy how to do it then? Was on another site I managed to find, didn't really want to sign up. System function seems simple but you can't change the background on its own? * - Remix - Apr 3, 2016 (Apr 3, 2016 10:30 AM)Wonga Wrote: Was on another site I managed to find, didn't really want to sign up. What do you mean with "on its own"? * - 0xDEAD10CC - Apr 3, 2016 You will have to use Console Buffers for this to get the size of the Window, and then use the SetConsoleScreenBufferInfoEx() to set the color for that buffer. Grabbing the console buffer info can be done with the GetConsoleScreenBufferInfoEx() function. |