#include #include #include StatusInfo::StatusInfo(void) : mSystemBorderDelta(0), mSystemBorderDeltaTimesTwo(0), mSystemBorderDeltaTimesThree(0), mSystemBorderDeltaTimesEight(0), mSystemBorderDeltaTimesNine(0), mStatusBarHeight(0), mStatusInfoWidth(), mStateInfoWidth(0), mhStatusBarFont(0), mWindowsVersion(WIN30) { TEXTMETRIC tm; WORD fontHeight; HFONT hOldFont; HDC hDC(::GetDC(0)); DWORD windowsVersion; mSystemBorderDelta=::GetSystemMetrics(SM_CYBORDER); mSystemBorderDeltaTimesTwo=mSystemBorderDelta*2; mSystemBorderDeltaTimesThree=mSystemBorderDelta*3; mSystemBorderDeltaTimesEight=mSystemBorderDelta*8; mSystemBorderDeltaTimesNine=mSystemBorderDelta*9; fontHeight=::MulDiv(12,::GetDeviceCaps(hDC,LOGPIXELSY),72); mhStatusBarFont=::CreateFont(fontHeight,0,0,0,400,0,0,0, ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,VARIABLE_PITCH|FF_SWISS,"Helv"); hOldFont=(HFONT)::SelectObject(hDC,mhStatusBarFont); ::GetTextMetrics(hDC,&tm); ::SelectObject(hDC,hOldFont); ::ReleaseDC(NULL, hDC); mStatusBarHeight=tm.tmHeight+tm.tmExternalLeading+(7*mSystemBorderDelta); mStatusInfoWidth=tm.tmMaxCharWidth*21; mStateInfoWidth=tm.tmMaxCharWidth*3; windowsVersion=::GetVersion(); if(LOWORD(windowsVersion)>=3&&HIWORD(windowsVersion)<10)mWindowsVersion=WIN30; else mWindowsVersion=WIN3X; }