Using this code:
Code:
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>
#include <string>
#include <fstream>
#include <conio.h>
#include <time.h>
#include <cstdlib>
#include <vector>
struct CONSOLE_FONT
{
DWORD index;
COORD dim;
};//CONSOLE_FONT
BOOL (WINAPI *SetConsoleFont)(HANDLE, DWORD);
BOOL (WINAPI *GetConsoleFontInfo)(HANDLE, BOOL, DWORD, CONSOLE_FONT*);
DWORD (WINAPI *GetNumberOfConsoleFonts)();
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
template<typename pfn_t>
inline bool LoadFunc(HMODULE hmod, const char *name, pfn_t &fn)
{
fn = (pfn_t)GetProcAddress(hmod, name);
return fn != 0;
}//LoadFunc
//------------------------------------------------------------------------------
using namespace std;
int main()
{
char title[MAX_PATH];
HWND hwnd;
if (!::GetConsoleTitleA(title, sizeof(title)) ||
!(hwnd = ::FindWindowA(0, title)))
{
cerr << "Failed to find console window" << endl;
return 1;
}//else
// Undocumented API's
HMODULE hmod = ::GetModuleHandleA("KERNEL32.DLL");
if (!hmod ||
!LoadFunc(hmod, "SetConsoleFont", SetConsoleFont) ||
!LoadFunc(hmod, "GetConsoleFontInfo", GetConsoleFontInfo) ||
!LoadFunc(hmod, "GetNumberOfConsoleFonts", GetNumberOfConsoleFonts))
{
cerr << "Failed to load API(s): " << ::GetLastError() << endl;
return 1;
}//if
HANDLE hOut = ::GetStdHandle(STD_OUTPUT_HANDLE);
// number of console fonts
const DWORD MAX_FONTS = 40;
DWORD num_fonts = GetNumberOfConsoleFonts();
if (num_fonts > MAX_FONTS)
num_fonts = MAX_FONTS;
CONSOLE_FONT fonts[MAX_FONTS] = {0};
GetConsoleFontInfo(hOut, 0, num_fonts, fonts);
for (DWORD n = 0; n < num_fonts; ++n)
{
fonts[n].dim = GetConsoleFontSize(hOut, fonts[n].index);
if (fonts[n].dim.X == 6 &&
fonts[n].dim.Y == 8)
{
SetConsoleFont(hOut, fonts[n].index);
::InvalidateRect(hwnd, 0, FALSE);
::UpdateWindow(hwnd);
system("cls");
cout<<"___ ___ ___ _______ | "<<endl;
Sleep(50);
cout<<"\\ / / / | ____ \\ | "<<endl;
Sleep(50);
cout<<" ___ ___ / / | | \\ \\ | "<<endl;
Sleep(50);
cout<<" \\ / / / | |____/ | | "<<endl;
Sleep(50);
cout<<" ___ ___ | | | / | "<<endl;
Sleep(50);
cout<<" \\ / | | | ______/ | "<<endl;
Sleep(50);
cout<<" ___ | | | | | "<<endl;
Sleep(50);
cout<<" / \\ | | | | | "<<endl;
Sleep(50);
cout<<" ___ ___ | | | | | "<<endl;
Sleep(50);
cout<<" / \\ \ \\ \\ | | | "<<endl;
Sleep(50);
cout<<" ___ ___ \\ \\ | | | "<<endl;
Sleep(50);
cout<<" / \\ \\__\\ |_| | ";
Sleep(50);
cout<<endl<<"_____________________________________________| ";
SetConsoleTitle("Xtended Command Prompt");
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0c");
Sleep(1);
system("color 0e");
Sleep(1);
system("color 0f");
Sleep(1);
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
cout<<endl<< " |";
cout<<endl<< " |";
cout<<endl<< "Brad Szymanski XCP [Version 8.1.4000] |"<<endl;
cout<< "Copyright (c) 2008 Brad Szymanski. |"<<endl;
cout<< "All rights reserved. |"<<endl;
cout<< " |"<<endl;
char CM[9999];
char PAATH[9999];
ifstream inFile;
system("color 0e");
::GetCurrentDirectoryA(9999,PAATH);
while (1)
{
SetConsoleTitle("Xtended Command Prompt");
cout<<"______________________________________________________________________________"<<endl;
cout<<endl<<PAATH<<"> ";
cin.getline(CM, 9999);
cout<<endl;
if (!stricmp(CM, "close"))
{
return 0;
}
if (!stricmp(CM, "exit"))
{
return 0;
}
if (!stricmp(CM, "checkcon"))
{
cout<<"Checking connections..."<<endl<<endl;
system("netstat -n > CHECKCON1.txt");
Sleep(5000);
system("netstat -n > CHECKCON2.txt");
system("FC CHECKCON1.txt CHECKCON2.txt");
system("del CHECKCON1.txt /f /q");
system("del CHECKCON2.txt /f /q");
goto LULZ;
}
if ( !stricmp(CM, "thanks"))
{
cout<<endl<<"You're welcome"<<endl;
goto LULZ;
}
if (!stricmp(CM, "cd"))
{
cout<<endl<<"Path: ";
cin.getline(PAATH, 9999);
cout<<endl;
::SetCurrentDirectory(PAATH);
cout<<"Path Changed to: "<<PAATH<<endl;
goto LULZ;
}
if ( !stricmp(CM, "checkcon /?"))
{
cout<<"Checks connection IPs, waits 5 seconds, checks again and"<<endl;
cout<<"displays the differences."<<endl;
goto LULZ;
}
if ( !stricmp(CM, "flash"))
{
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0c");
Sleep(1);
system("color 0e");
Sleep(1);
system("color 0f");
Sleep(1);
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0c");
Sleep(1);
system("color 0e");
Sleep(1);
system("color 0f");
Sleep(1);
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0a");
Sleep(1);
system("color 0b");
Sleep(1);
system("color 0e");
goto LULZ;
}
if (!stricmp(CM, "cls"))
{
system("cls");
cout<<"___ ___ ___ _______ | "<<endl;
Sleep(50);
cout<<"\\ / / / | ____ \\ | "<<endl;
Sleep(50);
cout<<" ___ ___ / / | | \\ \\ | "<<endl;
Sleep(50);
cout<<" \\ / / / | |____/ | | "<<endl;
Sleep(50);
cout<<" ___ ___ | | | / | "<<endl;
Sleep(50);
cout<<" \\ / | | | ______/ | "<<endl;
Sleep(50);
cout<<" ___ | | | | | "<<endl;
Sleep(50);
cout<<" / \\ | | | | | "<<endl;
Sleep(50);
cout<<" ___ ___ | | | | | "<<endl;
Sleep(50);
cout<<" / \\ \ \\ \\ | | | "<<endl;
Sleep(50);
cout<<" ___ ___ \\ \\ | | | "<<endl;
Sleep(50);
cout<<" / \\ \\__\\ |_| | ";
Sleep(50);
cout<<endl<<"_____________________________________________| ";
SetConsoleTitle("Xtended Command Prompt");
cout<<endl<< " |";
cout<<endl<< " |";
cout<<endl<< "Brad Szymanski XCP [Version 8.1.4000] |"<<endl;
cout<< "Copyright (c) 2008 Brad Szymanski. |"<<endl;
cout<< "All rights reserved. |"<<endl;
cout<< " |"<<endl;
goto LULZ;
}
if (!stricmp(CM, "hide"))
{
HWND stealth;
AllocConsole();
stealth=FindWindowA("ConsoleWindowClass",NULL);
ShowWindow(stealth,0);
goto LULZ;
}
if (!stricmp(CM, "hide /?"))
{
cout<<"Hides the console."<<endl;
goto LULZ;
}
else
{
system(CM);
}
LULZ:;
}
return 0;
}
}
}
I get this:
C:\Users\bradszy\Documents\Projects\XCP Final\XCP FInal.cpp error: `GetConsoleFontSize' was not declared in this scope|
In code::blocks.
Makes Bradley sad.
Compiles perfectly in VC++.