Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.9 KiB

  1. //Copyright (c) 1997-2000 Microsoft Corporation
  2. #include "pch.hxx" // PCH
  3. #pragma hdrstop
  4. /////////////////////////////////////////////////////////////////
  5. // This file exists for creating the pre-compiled header only. //
  6. /////////////////////////////////////////////////////////////////
  7. #include "resource.h"
  8. void FixupLogfont(LOGFONT *pLogFont)
  9. {
  10. TCHAR lfFaceName[LF_FACESIZE];
  11. _ASSERTE(ARRAYSIZE(lfFaceName) == ARRAYSIZE(pLogFont->lfFaceName));
  12. // This makes sure that logfonts don't have any garbage characters after the NULL termination
  13. ZeroMemory(lfFaceName, ARRAYSIZE(lfFaceName));
  14. lstrcpy(lfFaceName, pLogFont->lfFaceName);
  15. memcpy(pLogFont->lfFaceName, lfFaceName, ARRAYSIZE(lfFaceName));
  16. }
  17. void GetNonClientMetrics(NONCLIENTMETRICS *pncm, LOGFONT *plfIcon)
  18. {
  19. ZeroMemory(pncm, sizeof(*pncm));
  20. ZeroMemory(plfIcon, sizeof(*plfIcon));
  21. pncm->cbSize = sizeof(*pncm);
  22. SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(*pncm), pncm, 0);
  23. SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(*plfIcon), plfIcon, 0);
  24. // We fix up the log fonts so they can be compared with our new logfonts by a memcmp() call
  25. FixupLogfont(&pncm->lfCaptionFont);
  26. FixupLogfont(&pncm->lfSmCaptionFont);
  27. FixupLogfont(&pncm->lfMenuFont);
  28. FixupLogfont(&pncm->lfStatusFont);
  29. FixupLogfont(&pncm->lfMessageFont);
  30. FixupLogfont(plfIcon);
  31. }
  32. BOOL IsCurrentFaceNamesDifferent()
  33. {
  34. TCHAR lfFaceName[LF_FACESIZE];
  35. LoadString(g_hInstDll, IDS_SYSTEMFONTNAME, lfFaceName, ARRAYSIZE(lfFaceName));
  36. NONCLIENTMETRICS ncm;
  37. LOGFONT lfIcon;
  38. GetNonClientMetrics(&ncm, &lfIcon);
  39. if( 0 != lstrcmp(lfFaceName, ncm.lfCaptionFont.lfFaceName)
  40. || 0 != lstrcmp(lfFaceName, ncm.lfSmCaptionFont.lfFaceName)
  41. || 0 != lstrcmp(lfFaceName, ncm.lfMenuFont.lfFaceName)
  42. || 0 != lstrcmp(lfFaceName, ncm.lfStatusFont.lfFaceName)
  43. || 0 != lstrcmp(lfFaceName, ncm.lfMessageFont.lfFaceName)
  44. || 0 != lstrcmp(lfFaceName, lfIcon.lfFaceName) )
  45. {
  46. return TRUE;
  47. }
  48. return FALSE;
  49. }