As Nick Brooks noted, you can use GDI calls in console applications, but graphics cannot be displayed in the same window as text I / O consoles. This can make a difference, as you can draw text elements in GDI.
A simplified interface for GDI calls in console applications is provided by WinBGIm . This is a clone of the Borland DOS BGI API, but with extensions for handling resizable windows, mouse input, and 24-bit color models. Since it is available as source code, it also serves as a good demonstration of using GDI in this way.
You can also have both a console and a GDI window, or you can disable the console window by indicating that the application is a graphical interface (the -mwindows linker option in the GNU toolchain) - note that specifying a GUI application really only suppresses the console, this is only GUI application if it has a message loop. Having a console is suitable for debugging, since stdout and stderr are displayed by default.
Clifford
source share