I use a Console window to debug all of my applications, with or without GUI.
I use pure Win32 API in most of the cases.
See
This article[
^]
Not only that it possible but you can set colors and font styles.
First, you call:
#include <conio.h>
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
To set the text color, I use:
inline void setcolor(int textcol, int backcol)
{
if ((textcol % 16) == (backcol % 16))textcol++;
textcol %= 16; backcol %= 16;
unsigned short wAttributes = ((unsigned)backcol << 4) | (unsigned)textcol;
CONSOLE_SCREEN_BUFFER_INFO csbi;
SetConsoleTextAttribute(hConsole, wAttributes);
}
Then, just use
wprintf() to display the text.
If you wish to clear the display area, just call:
system("cls");
Also refresh the display by calling:
void refresh()
{
HWND hwnd = FindWindowEx(NULL, NULL, L"CabinetWClass", NULL);
while (hwnd != NULL)
{
PostMessage(hwnd, WM_COMMAND, 41504, 0);
hwnd = FindWindowEx(NULL, hwnd, L"CabinetWClass", NULL);
}
}