Windows SetConsoleScreenBufferSize() returning an odd error code

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Oct 5 11:33:35 PDT 2013


On 10/5/13, webwraith <webwraith at fastmail.fm> wrote:
> ...And that will teach me to look further. SM_CXMIN and SM_CYMIN
> are measured in pixels. I'll need to find out how big my font is,
> as well, but I'm pretty sure that 60x30 at the default system
> font should be bigger.

Ah right you are. For that I think you can use something like this:

TEXTMETRIC tm;
GetTextMetrics(hdc, &tm);   // Dimensions of the system font don't change
                                         // during a Windows session
int cxChar = tm.tmAveCharWidth;
int cyChar = tm.tmHeight + tm.tmExternalLeading;

There's a bunch of these calls in the SysMetrics examples you can look at here:
https://github.com/AndrejMitrovic/DWinProgramming/tree/master/Samples/Chap04


More information about the Digitalmars-d-learn mailing list