/** * @file XTPSystemMetrics.cpp * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ #include "StdAfx.h" #include "Common/XTPTypeId.h" #include "Common/XTPSystemHelpers.h" #include "Common/XTPSynchro.h" #include "Common/XTPApplication.h" #include "Common/XTPSingleton.h" #include "Common/XTPSystemMetrics.h" #include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" #ifdef _DEBUG # define new DEBUG_NEW # undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif /////////////////////////////////////////////////////////////////////////////// // CXTPSystemMetrics CXTPSystemMetrics* AFX_CDECL XTPSystemMetrics() { return &CXTPSingleton::Instance(); } CXTPSystemMetrics::CXTPSystemMetrics() : m_nBorderY(0) , m_nCaptionY(0) , m_nSizeFrameY(0) { RefreshMetrics(); } void CXTPSystemMetrics::RefreshMetrics() { CXTPSystemMetrics systemMetricsOld(*this); m_nBorderY = ::GetSystemMetrics(SM_CYBORDER); m_nCaptionY = ::GetSystemMetrics(SM_CYCAPTION); m_nSizeFrameY = ::GetSystemMetrics(SM_CYSIZEFRAME); m_nSmallIconX = ::GetSystemMetrics(SM_CXSMICON); m_nSmallIconY = ::GetSystemMetrics(SM_CYSMICON); m_nIconX = ::GetSystemMetrics(SM_CXICON); m_nIconY = ::GetSystemMetrics(SM_CYICON); } /////////////////////////////////////////////////////////////////////////////// // CXTPDeviceCaps CXTPDeviceCaps* AFX_CDECL XTPDeviceCaps() { return &CXTPSingleton::Instance(); } CXTPDeviceCaps::CXTPDeviceCaps() : m_nLogPixelsX(0) , m_nLogPixelsY(0) { RefreshMetrics(); } void CXTPDeviceCaps::RefreshMetrics() { HDC hDC = ::GetDC(NULL); // Log pixels m_nLogPixelsX = ::GetDeviceCaps(hDC, LOGPIXELSX); m_nLogPixelsY = ::GetDeviceCaps(hDC, LOGPIXELSY); ::ReleaseDC(NULL, hDC); }