How to Set font size?

Hello everyone,
Is there any way to change the font size to small during runtime by code?
Last edited on
In a console window ?
@SamuelAdams yes in console.
The windows console has 1 font and 1 color at a time unless your program can over-ride that. There are libraries to do that, but nothing standard.

I found a huge batch file that didn't work for winX online. Maybe someone can fix it or you can get it working (?)..

@echo off
setlocal enabledelayedexpansion enableextensions
set "cmd.con=HKCU\Console\%%SystemRoot%%_system32_cmd.exe /v"
set "ram=!tmp!\WRAM.tmp"
del "%tmp%\_$xy.bat">nul 2>&1
if [%1]==[ok] goto:init
Reg export HKCU\Console Backup.reg>nul
Reg delete HKCU\Console\%%SystemRoot%%_system32_cmd.exe /f>nul
for %%a in (
"FaceName /t REG_SZ /d "Terminal" /f"
"FontFamily /t REG_DWORD /d 48 /f"
"FontSize /t REG_DWORD /d 1024294 /f"
"FontWeight /t REG_DWORD /d 700 /f"
"ScreenBufferSize /t REG_DWORD /d 13107280 /f"
"CursorSize /t REG_DWORD /d 0 /f"
) do (
set "param=%%a"
set "param=!param:~1!"
set "param=%cmd.con% !param:~0,-1!"
Reg Add !param! >nul
)
start /high cmd /q /k "%~0" ok
for %%a in (
"FaceName /f"
"FontFamily /f"
"FontSize /f"
"FontWeight /f"
"CursorSize /f"
) do (
set "param=%%a"
set "param=!param:~1!"
set "param=%cmd.con% !param:~0,-1!"
Reg Delete !param! >nul
)


OMG that's huge! and out of knowledge..
This looks easier:
http://www.cplusplus.com/forum/general/118967/

Thank you very much @Thomas1956. You are always there whenever I'm in a problem. Love and Respect for You...
that was neat, I didnt know that worked on consoles.
It is a relatively recent addition to the Windows Console API. Make sure that _WIN32_WINNT is defined to a value of 0x0500 or greater before you #include <windows.h>.
Registered users can post here. Sign in or register to post.