Is it possible to change the size, position, background colour, foreground colour of the default console window that the first programs I am currently exploring use?
Is it possible to change the size, position, background colour, foreground colour of the default console window that the first programs I am currently exploring use?
Programatically? Yes via the windows API. However this isn't necessarily something you want to focus to much on when just learning how to program. adrianxw has decent tutorials on console programming, however like I said not really something you want to focus on. Additionally, for GUI programming in C++, the suggested course is QT, however you really need to learn more C++ before diving into that.
Thanks for the advice Andrew and I realise it is sound; but it is infuriating having to do everything in a 7½ x 3½ window - I assume then that I cannot somehow change it from within Code::Blocks?
Oh, I think I see what you are saying. Just compile your code and then run it from the command prompt, this will give you the windows "dos window" which you can change the size of just like any other window. As for C::B I am not sure, perhaps there is some settings you can adjust. I am sure someone knows around here, also you can check your help file for C::B.
Yes, I just looked through our Setting up C::B tutorial and it looks like once you hit F9 it spawns the standard windows console window. Which you can just grab the corner of and drag to resize.
You can indeed change the height of the console window by dragging but not the width.
Googling found the following which when run gives you a console window listing the colours available.
If you change "Color )G" to eg "Color f1" you get blue text on a white background, so until I am ready to start GUI programming that will do most of what I want.Code:#include <iostream> #include <cstdlib> using namespace std; int main() { system ("TITLE Color Program"); system ("Color )G"); return 0; }
Sorry Andrew, I obviously misunderstood your first comments- I assumed you meant that changing colours etc couldn't be done except by getting into programming with Windows API - had another look and will study Adrian's tutorials closely later today.
Besides the tutorial you can also check out the Windows SDK documentation for console functions. There are a whole host of functions related solely to the console.
In the SDK index type in AllocConsole and from there you should be able to find a link to all of the console related functions.
Actually you are working on a visual representation of the old DOS 25 x 80 screen... In CMD.EXE they've added buffering so you can scroll back but it's still a Command Line Interface, intended to deliberately emulate DOS.
If you want GUI style windows... use Windows... theForger's Win32 API Tutorial