"Ivan Sinitsin" ivan@etersoft.ru wrote:
- static const WCHAR sFont[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
- HDC hdc = GetDC(0);
...
if( RegQueryValueEx( hKey, reg_font_facename, NULL, &type,
(LPBYTE) &logfont.lfFaceName, &sizeW) != ERROR_SUCCESS )
- strcpyW(logfont.lfFaceName,sFont);
It's not very useful to use by default the font that is not available on any Linux installation by default. I'd suggest to use GetStockObject(DEFAULT_GUI_FONT) instead. And you are leaking an hdc.
LOGFONT logfont;
wi.cbSize = sizeof( WINDOWINFO ); GetWindowInfo(Globals.hMainWnd, &wi); width = wi.rcWindow.right - wi.rcWindow.left; height = wi.rcWindow.bottom - wi.rcWindow.top;
GetObject((HGDIOBJ)Globals.hfont, sizeof(logfont), (LPVOID)&logfont);
This cast is not needed.