Changeset 541
- Timestamp:
- 11/13/2008 11:32:25 AM (5 years ago)
- Location:
- branches/eraser6/Installer/Bootstrapper
- Files:
-
- 2 edited
-
Bootstrapper.h (modified) (1 diff)
-
Main.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Installer/Bootstrapper/Bootstrapper.h
r539 r541 65 65 66 66 private: 67 68 67 /// Registers the main window class and creates it. 69 68 bool InitInstance(); 69 70 /// Helper function to set the window font for created windows to the system default. 71 void SetWindowFont(HWND hWnd); 70 72 }; 71 73 -
branches/eraser6/Installer/Bootstrapper/Main.cpp
r540 r541 37 37 //Static variables 38 38 HINSTANCE hInstance = NULL; 39 40 bool InitInstance(HINSTANCE hInstance, HWND& hWnd);41 void SetWindowFont(HWND hWnd);42 39 LRESULT __stdcall WndProc(HWND, UINT, WPARAM, LPARAM); 43 40 … … 82 79 std::wstring DirName; 83 80 }; 84 85 86 87 88 /// Helper function to set the window font for created windows to the system default.89 void SetWindowFont(HWND hWnd)90 {91 HFONT hWndFont = NULL;92 if (!hWndFont)93 {94 NONCLIENTMETRICS ncm;95 ::ZeroMemory(&ncm, sizeof(ncm));96 ncm.cbSize = sizeof(ncm);97 98 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0) )99 {100 #if WINVER >= 0x0600101 // a new field has been added to NONCLIENTMETRICS under Vista, so102 // the call to SystemParametersInfo() fails if we use the struct103 // size incorporating this new value on an older system -- retry104 // without it105 ncm.cbSize -= sizeof(int);106 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0) )107 #endif108 return;109 }110 111 hWndFont = CreateFontIndirectW(&ncm.lfMessageFont);112 }113 114 SendMessage(hWnd, WM_SETFONT, (WPARAM)hWndFont, MAKELPARAM(TRUE, 0));115 }116 81 117 82 /// Processes messages for the main window. … … 286 251 } 287 252 253 void MainWindow::SetWindowFont(HWND hWnd) 254 { 255 HFONT hWndFont = NULL; 256 if (!hWndFont) 257 { 258 NONCLIENTMETRICS ncm; 259 ::ZeroMemory(&ncm, sizeof(ncm)); 260 ncm.cbSize = sizeof(ncm); 261 262 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0) ) 263 { 264 #if WINVER >= 0x0600 265 // a new field has been added to NONCLIENTMETRICS under Vista, so 266 // the call to SystemParametersInfo() fails if we use the struct 267 // size incorporating this new value on an older system -- retry 268 // without it 269 ncm.cbSize -= sizeof(int); 270 if ( !::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0) ) 271 #endif 272 return; 273 } 274 275 hWndFont = CreateFontIndirectW(&ncm.lfMessageFont); 276 } 277 278 SendMessage(hWnd, WM_SETFONT, (WPARAM)hWndFont, MAKELPARAM(TRUE, 0)); 279 } 280 288 281 void MainWindow::SetProgress(float progress) 289 282 {
Note: See TracChangeset
for help on using the changeset viewer.
