Setting Console Font in C on Windows 10 -
i trying change size of console font in console application during runtime.
looking windows documentation, found following functions: getcurrentconsolefont
(and getcurrentconsolefontex
) , setcurrentconsolefontex
.
console_font_info prevfontinfo = {sizeof(prevfontinfo)}; getcurrentconsolefont( getstdhandle(std_output_handle), false, &prevfontinfo ); console_font_info fontinfo = {0}; //fontinfo.cbsize = sizeof(prevfontinfo); fontinfo.dwfontsize.x = 30; fontinfo.dwfontsize.y = 70; //fontinfo.fontweight = 700; setcurrentconsolefontex( getstdhandle(std_output_handle), false, &fontinfo ); ... (some irrelevant code here) setcurrentconsolefontex( getstdhandle(std_output_handle), false, &prevfontinfo );
currently getting following warnings:
implicit declaration of function 'getcurrentconsolefont'
and
implicit declaration of function 'setcurrentconsolefont'
i tried using getconsolefontex
(the reason fontweight
, cbsize
commented out) no prevail. used console_font_infoex
well, resulted in following error:
unkown type name 'console_font_infoex'
i read necessary use following:
#define _win32_winnt 0x0500
i tried several variations of (0x0502, 0x0600, ect.), nothing seemed change warnings/errors.
i include following windows headers, , compile -lkernel32.
#define _win32_winnt 0x0500 #include <windows.h> #include <wincon.h> #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <time.h>
i wish change font size in c windows terminal @ runtime. how do that? why not working?
Comments
Post a Comment