@@ -281,6 +281,7 @@ class CWebWindow
281
281
WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
282
282
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
283
283
m_hWebViewParent, nullptr , hInstance, nullptr );
284
+ bool bWin10orGreater = IsWin10OrGreater ();
284
285
HDC hDC = GetDC (m_hWnd);
285
286
LOGFONT lfToolbar{};
286
287
lfToolbar.lfHeight = MulDiv (-14 , GetDeviceCaps (hDC, LOGPIXELSX), 72 );
@@ -289,7 +290,7 @@ class CWebWindow
289
290
lfToolbar.lfOutPrecision = OUT_TT_ONLY_PRECIS;
290
291
lfToolbar.lfQuality = PROOF_QUALITY;
291
292
lfToolbar.lfPitchAndFamily = VARIABLE_PITCH | FF_DECORATIVE;
292
- wcscpy_s (lfToolbar.lfFaceName , L" Segoe MDL2 Assets" );
293
+ wcscpy_s (lfToolbar.lfFaceName , bWin10orGreater ? L" Segoe MDL2 Assets" : L" Segoe UI Symbol " );
293
294
NONCLIENTMETRICS info{ sizeof (info) };
294
295
SystemParametersInfo (SPI_GETNONCLIENTMETRICS, sizeof (info), &info, 0 );
295
296
LOGFONT lfEdit = info.lfCaptionFont ;
@@ -298,10 +299,10 @@ class CWebWindow
298
299
m_hEditFont = CreateFontIndirect (&lfEdit);
299
300
SendMessage (m_hToolbar, TB_BUTTONSTRUCTSIZE, sizeof (TBBUTTON), 0 );
300
301
TBBUTTON tbb[] = {
301
- {I_IMAGENONE, ID_GOBACK, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)L" \uE0A6 " },
302
- {I_IMAGENONE, ID_GOFORWARD, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)L" \uE0AB " },
303
- {I_IMAGENONE, ID_RELOAD, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)L" \uE149 " },
304
- {I_IMAGENONE, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)L" \uE106 " },
302
+ {I_IMAGENONE, ID_GOBACK, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)(bWin10orGreater ? L" \uE0A6 " : L" \u25C0 " ) },
303
+ {I_IMAGENONE, ID_GOFORWARD, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)(bWin10orGreater ? L" \uE0AB " : L" \u25B6 " ) },
304
+ {I_IMAGENONE, ID_RELOAD, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)(bWin10orGreater ? L" \uE149 " : L" \u21BB " ) },
305
+ {I_IMAGENONE, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, {}, 0 , (INT_PTR)(bWin10orGreater ? L" \uE106 " : L" \u2715 " ) },
305
306
};
306
307
m_hEdit = CreateWindowEx (0 , TEXT (" EDIT" ), TEXT (" " ),
307
308
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
@@ -572,7 +573,7 @@ class CWebWindow
572
573
573
574
WDocument document;
574
575
document.Parse (result.returnObjectAsJson );
575
- UINT dpi = GetDpiForWindow (m_hWnd);
576
+ UINT dpi = MyGetDpiForWindow (m_hWnd);
576
577
int width = document[L" cssContentSize" ][L" width" ].GetInt ()
577
578
* dpi / 96 ;
578
579
int height = document[L" cssContentSize" ][L" height" ].GetInt ()
@@ -1912,6 +1913,18 @@ class CWebWindow
1912
1913
return lResult;
1913
1914
}
1914
1915
1916
+ static UINT MyGetDpiForWindow (HWND hWnd)
1917
+ {
1918
+ if (GetDpiForWindowFunc)
1919
+ return GetDpiForWindowFunc (hWnd);
1920
+ return GetDeviceCaps (GetDC (nullptr ), LOGPIXELSX);
1921
+ }
1922
+
1923
+ bool IsWin10OrGreater ()
1924
+ {
1925
+ return GetDpiForWindowFunc != nullptr ;
1926
+ }
1927
+
1915
1928
const int ID_TOOLTIP_TIMER = 1 ;
1916
1929
const int TOOLTIP_TIMEOUT = 5000 ;
1917
1930
HWND m_hWnd = nullptr ;
@@ -1937,5 +1950,10 @@ class CWebWindow
1937
1950
std::wstring m_toolTipText = L" test" ;
1938
1951
bool m_showToolTip = false ;
1939
1952
std::wstring m_webmessage;
1953
+ inline static const auto GetDpiForWindowFunc = []() {
1954
+ HMODULE hUser32 = GetModuleHandle (L" user32.dll" );
1955
+ return reinterpret_cast <decltype (&::GetDpiForWindow)>(
1956
+ ::GetProcAddress (hUser32, " GetDpiForWindow" ));
1957
+ }();
1940
1958
};
1941
1959
0 commit comments