Get Console Font Cplusplus

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
684 B
1
Indexable
Never
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
#define _WIN32_WINNT 0x500
#include <windows.h>

int main()
{
    HWND hwnd;
    hwnd = GetConsoleWindow();
    std::cout << "HWND:" << hwnd << "\n";

    CONSOLE_FONT_INFO lpConsoleCurrentFont;
    GetCurrentConsoleFont(hwnd, false, &lpConsoleCurrentFont);
    std::cout << "Font:" << lpConsoleCurrentFont.nFont <<"\n";

    COORD cord;
    cord = GetConsoleFontSize(hwnd, lpConsoleCurrentFont.nFont);
    std::cout << "FontSize:(" << cord.X <<":" << cord.Y << ")\n";

    system("PAUSE");
    return 0;
}