Was ist das/Was macht das ? ;-)
-
Hallo zusammen, schönen gute Abend!
Ich habe hier folgenden Code gefunden:
HDC hDC = GetDC(hWnd); int nHeight = -MulDiv(14, GetDeviceCaps(hDC, LOGPIXELSY), 72); HFONT hFont = CreateFont(nHeight, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial")); ReleaseDC(hWnd, hDC);
Mir ist alles einleuchtend, bis auf diese Zeile:
int nHeight = -MulDiv(14, GetDeviceCaps(hDC, LOGPIXELSY), 72);
Was wird da berechnet ? Was soll das ?
Schonmal danke für Erklärungen !
Viele Grüße,
GDI-Coder!
-
http://www.willemer.de/informatik/windows/winfont.htm
Da wird Punkt in Pixel umgerechnet, MulDiv ist übrigens ein Makro (keine Funktion)
-
keksekekse schrieb:
http://www.willemer.de/informatik/windows/winfont.htm
Da wird Punkt in Pixel umgerechnet, MulDiv ist übrigens ein Makro (keine Funktion)
MulDiv ist eine Funktion! Siehe: http://msdn2.microsoft.com/en-us/library/aa383718.aspx
MSDN schrieb:
The MulDiv function multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value. The return value is rounded up or down to the nearest integer.
@GDI-Coder: Vllt ist das noch interesant: http://wvware.sourceforge.net/caolan/mapmode.html
-
CodeFinder schrieb:
MulDiv ist eine Funktion!
sogar eine assemblerfunktion.
;----------------------------Module-Header------------------------------; ; Module Name: muldiv.asm ; ; (w * Numer) / Denom with correct rounding. ; ; Created: ; Author: ; ; Copyright (c) 1985, 1986, 1987 Microsoft Corporation ; ; MulDiv(w, Numer, Denom) returns (w * Numer) / Denom rounded to the nearest ; integer. A check is made so that division by zero is not attempted. ;-----------------------------------------------------------------------;