Tech Tips
By George Frasier, October 01, 2002
Font creation and rounding differences
Philip Hamer
How to relocate GetOpenFileName dialogs
Stephen Schumacher
Querying Multiple IDispatch method identifiers
Matthew Wilson
Partial array expansion in the Microsoft Visual Studio Debugger
Gigi Sayfan
October 2002/Tech Tips
Listing 2: A sample hook procedure
/*
* Initialize lfHeight to 10 times the desired point size. Pass a HDC to use
* to convert to logical units, or NULL to use a screen DC.
*/
HFONT CreatePointFontIndirect(const LOGFONT *pLF, HDC hDC)
{
LOGFONT lf = *pLF;
POINT pt, ptOrg = {0,0};
BOOL bScreenDC = (hDC == NULL);
if (bScreenDC)
hDC = GetDC(NULL); /* Get screen DC */
pt.y = MulDiv(lf.lfHeight, GetDeviceCaps(hDC, LOGPIXELSY), 720);
DPtoLP(hDC, &pt, 1);
DPtoLP(hDC, &ptOrg, 1);
lf.lfHeight = -abs(pt.y - ptOrg.y);
if (bScreenDC)
ReleaseDC(NULL, hDC);
return CreateFontIndirect(&lf);
}