Changeset 494 for trunk/Utilities/RotView/AboutDialog.h
- Timestamp:
- Jul 25, 2015, 10:13:05 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/RotView/AboutDialog.h
r156 r494 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 20 12-20132 // Copyright (C) Roman Ryltsov, 2006-2015 3 3 // Created by Roman Ryltsov roman@alax.info 4 // 5 // A permission to use the source code is granted as long as reference to 6 // source website http://alax.info is retained. 4 7 5 8 #pragma once 6 9 10 #include <atlsecurity.h> 7 11 #include <atlctrls.h> 8 12 #include <atlctrlx.h> … … 35 39 public: 36 40 // CAboutDialog 37 static CFontHandle CreateTitleFont() throw()41 static CFontHandle CreateTitleFont() 38 42 { 39 43 CLogFont LogFont; … … 41 45 LogFont.lfWeight = FW_BOLD; 42 46 LogFont.lfItalic = TRUE; 43 _tcsncpy_s(LogFont.lfFaceName, _ countof(LogFont.lfFaceName), _T("Arial"), _TRUNCATE);47 _tcsncpy_s(LogFont.lfFaceName, _T("Arial"), _TRUNCATE); 44 48 CFont Font; 45 49 _W(Font.CreateFontIndirect(&LogFont)); 46 50 return Font.Detach(); 47 51 } 48 static CFontHandle CreateDisclaimerFont() throw()52 static CFontHandle CreateDisclaimerFont() 49 53 { 50 54 CLogFont LogFont; 51 55 LogFont.lfHeight = -MulDiv(7, GetDeviceCaps(CClientDC(GetDesktopWindow()), LOGPIXELSY), 72); 52 56 LogFont.lfWeight = FW_NORMAL; 53 _tcsncpy_s(LogFont.lfFaceName, _ countof(LogFont.lfFaceName), _T("Lucida Console"), _TRUNCATE);57 _tcsncpy_s(LogFont.lfFaceName, _T("Lucida Console"), _TRUNCATE); 54 58 CFont Font; 55 59 _W(Font.CreateFontIndirect(&LogFont)); 56 60 return Font.Detach(); 57 61 } 58 CAboutDialog() throw()62 CAboutDialog() 59 63 { 60 _Z4 (atlTraceRefcount, 4, _T("this 0x%p\n"), this);64 _Z4_THIS(); 61 65 } 62 ~CAboutDialog() throw()66 ~CAboutDialog() 63 67 { 64 _Z4(atlTraceRefcount, 4, _T("this 0x%p\n"), this); 68 _Z4_THIS(); 69 } 70 static BOOL IsAdministrator() 71 { 72 bool bIsMember = FALSE; 73 return CAccessToken().CheckTokenMembership(Sids::Admins(), &bIsMember) && bIsMember; 74 } 75 static VOID UpdateCaption(CWindow Window) 76 { 77 CString sCaption; 78 _W(Window.GetWindowText(sCaption)); 79 CRoArrayT<CString> SpecifierArray; 80 #if defined(_WIN64) 81 SpecifierArray.Add(_T("64-bit")); 82 #else 83 if(SafeIsWow64Process()) 84 SpecifierArray.Add(_T("32-bit")); 85 #endif // defined(_WIN64) 86 if(IsWindowsVistaOrGreater() && IsAdministrator()) 87 SpecifierArray.Add(_T("Administrator")); 88 if(!SpecifierArray.IsEmpty()) 89 sCaption = AtlFormatString(_T("%s (%s)"), sCaption, _StringHelper::Join(SpecifierArray, _T(", "))); 90 #if _TRACE 91 sCaption.Append(_T(" // ")); 92 #if _DEVELOPMENT 93 sCaption.Append(_T("Dev ")); 94 #endif // _DEVELOPMENT 95 sCaption.Append(_VersionInfoHelper::GetVersionString(_VersionInfoHelper::GetFileVersion(_VersionInfoHelper::GetModulePath()))); 96 #endif // _TRACE 97 Window.SetWindowText(sCaption); 65 98 } 66 99 … … 111 144 _W(m_EmailHyperStatic.SubclassWindow(GetDlgItem(IDC_ABOUT_EMAIL))); 112 145 #pragma endregion 113 #pragma region Caption 114 { 115 #if _TRACE || defined(_WIN64) 116 CString sCaption; 117 _W(GetWindowText(sCaption)); 118 sCaption.Append(_T(" // ")); 119 #if _DEVELOPMENT 120 sCaption.Append(_T("Dev ")); 121 #endif // _DEVELOPMENT 122 sCaption.Append(_VersionInfoHelper::GetVersionString(_VersionInfoHelper::GetFileVersion(_VersionInfoHelper::GetModulePath()))); 123 #if defined(_WIN64) 124 sCaption.Append(_T(" (x64)")); 125 #endif // defined(_WIN64) 126 _W(SetWindowText(sCaption)); 127 #endif // _TRACE || defined(_WIN64) 128 } 129 #pragma endregion 146 UpdateCaption(*this); 130 147 #pragma region Window Position and Focus 131 148 _W(CenterWindow(GetParent())); … … 134 151 return FALSE; 135 152 } 136 LRESULT OnDestroy() throw()153 LRESULT OnDestroy() 137 154 { 138 155 _W(m_TitleFont.DeleteObject()); … … 140 157 return 0; 141 158 } 142 LRESULT OnCommand(UINT, INT nIdentifier, HWND) throw()159 LRESULT OnCommand(UINT, INT nIdentifier, HWND) 143 160 { 144 161 _W(EndDialog(nIdentifier));
Note: See TracChangeset
for help on using the changeset viewer.