| | |
How can I change console application font size?
![]() |
The function is called CreateFont(), not something for the faint at heart!
[php]
HFONT CreateFont(
int nHeight, // logical height of font
int nWidth, // logical average character width
int nEscapement, // angle of escapement
int nOrientation, // base-line orientation angle
int fnWeight, // font weight
DWORD fdwItalic, // italic attribute flag
DWORD fdwUnderline, // underline attribute flag
DWORD fdwStrikeOut, // strikeout attribute flag
DWORD fdwCharSet, // character set identifier
DWORD fdwOutputPrecision, // output precision
DWORD fdwClipPrecision, // clipping precision
DWORD fdwQuality, // output quality
DWORD fdwPitchAndFamily, // pitch and family
LPCTSTR lpszFace // pointer to typeface name string
);
[/php]
[php]
HFONT CreateFont(
int nHeight, // logical height of font
int nWidth, // logical average character width
int nEscapement, // angle of escapement
int nOrientation, // base-line orientation angle
int fnWeight, // font weight
DWORD fdwItalic, // italic attribute flag
DWORD fdwUnderline, // underline attribute flag
DWORD fdwStrikeOut, // strikeout attribute flag
DWORD fdwCharSet, // character set identifier
DWORD fdwOutputPrecision, // output precision
DWORD fdwClipPrecision, // clipping precision
DWORD fdwQuality, // output quality
DWORD fdwPitchAndFamily, // pitch and family
LPCTSTR lpszFace // pointer to typeface name string
);
[/php]
May 'the Google' be with you!
•
•
•
•
Originally Posted by f_escobar82
I dont think this function will work for console apps. The program Im writing runs in DOS window.
http://www.daniweb.com/code/snippet176.html
check the lines ...
[php]
setcolor(YELLOW);
settextstyle(DEFAULT_FONT, HORIZ_DIR, 2); // 2 = size
outtextxy(20, 320, "Press any key ... ");
getch(); // wait
[/php]
Maybe you can modify these to suit your needs.
May 'the Google' be with you!
•
•
Join Date: Feb 2005
Posts: 4
Reputation:
Solved Threads: 0
thanks vegaseat, I dont think i explained what Im trying to do very well. I already have a working application that runs in a console window. But the default text is too small. This can be fixed by opening the console properties while the app is running and changing the font size to 18x10 and the screen buffer size to 79 characters wide by 25 characters high. I would like to be able to change these settings through to code. Windows.h includes a function called:
SetConsoleScreenBufferSize();
msdn describes it here:
http://www.symbolictools.de/public/p...nchar_7sv9.htm
the problem is that Im having trouble understanding how it works. I found a listing of various console functions here:
http://www.symbolictools.de/public/p...nchar_3vg3.htm
but the documentation is somewhat vague.
SetConsoleScreenBufferSize();
msdn describes it here:
http://www.symbolictools.de/public/p...nchar_7sv9.htm
the problem is that Im having trouble understanding how it works. I found a listing of various console functions here:
http://www.symbolictools.de/public/p...nchar_3vg3.htm
but the documentation is somewhat vague.
•
•
Join Date: Feb 2005
Posts: 4
Reputation:
Solved Threads: 0
heres a function that I wrote, but it seems to have no effect.
C Syntax (Toggle Plain Text)
void consoleResize(unsigned int x, unsigned int y) { COORD coord; HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); coord.X = x; coord.Y = y; SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE),coord); }
•
•
•
•
Originally Posted by f_escobar82
heres a function that I wrote, but it seems to have no effect.
C Syntax (Toggle Plain Text)
void consoleResize(unsigned int x, unsigned int y) { COORD coord; HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); coord.X = x; coord.Y = y; SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE),coord); }
May 'the Google' be with you!
•
•
Join Date: Mar 2004
Posts: 1,620
Reputation:
Solved Threads: 51
Hi,
I wonder if you can go to your user community and just change the DOC in the README to change the environment defined by the icon. Right-click on the icon, change the properties to this x that, and then save. Yes, it is a user step. Or, maybe you alter your installer to do the configuration for you!
Christian
I wonder if you can go to your user community and just change the DOC in the README to change the environment defined by the icon. Right-click on the icon, change the properties to this x that, and then save. Yes, it is a user step. Or, maybe you alter your installer to do the configuration for you!
Christian
![]() |
Similar Threads
- Is there a way to change the console application font? (C++)
- Change Web Page Font Size on the Fly (Windows tips 'n' tweaks)
Other Threads in the C Forum
- Previous Thread: Need Help Reading a csv file created from MSExcel
- Next Thread: what is "unresolved external..."???
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking hardware highest histogram i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue number odf opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf scripting segmentationfault sequential shape socket socketprograming standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi






