@@ -11,6 +11,7 @@ const TCHAR g_szClsid[] = TEXT("{55BBF1B8-0D30-4908-BE0C-D576612A0F48}");
1111HINSTANCE g_hinstDll = NULL ;
1212LPWSTR g_versionInfo = NULL ;
1313LONG g_lLocks = 0 ;
14+ int g_deviceYDPI = 96 ;
1415#ifdef _DEBUG
1516HMODULE g_hWebView2Loader = NULL ;
1617LPFNCreateCoreWebView2EnvironmentWithOptions _CreateCoreWebView2EnvironmentWithOptions = NULL ;
@@ -1076,7 +1077,10 @@ STDMETHODIMP CteBase::DoVerb(LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSit
10761077 if (iVerb == OLEIVERB_INPLACEACTIVATE ) {
10771078 m_hwndParent = hwndParent;
10781079 WCHAR pszDataPath[MAX_PATH ], pszSetting[MAX_PATHEX + 128 ], pszProxyServer[MAX_PATHEX ], pszProxyOverride[MAX_PATHEX ], pszTemp[MAX_PATHEX ];
1079- lstrcpy (pszSetting, L" --allow-file-access-from-files --disable-gpu --embedded-browser-webview-dpi-awareness=1" );
1080+ HDC hdc = GetDC (hwndParent);
1081+ g_deviceYDPI = GetDeviceCaps (hdc, LOGPIXELSY );
1082+ ReleaseDC (hwndParent, hdc);
1083+ swprintf_s (pszSetting, MAX_PATH , L" --allow-file-access-from-files --disable-gpu --disable-extensions --disable-features=IsolateOrigins,site-per-process --force-device-scale-factor=%g" , g_deviceYDPI / 96.0 );
10801084 GetTempPath (MAX_PATH , pszDataPath);
10811085 PathAppend (pszDataPath, L" tablacus" );
10821086
@@ -1222,10 +1226,7 @@ STDMETHODIMP CteBase::SetObjectRects(LPCRECT lprcPosRect, LPCRECT lprcClipRect)
12221226 GetClientRect (m_hwndParent, &bounds);
12231227 lprcClipRect = &bounds;
12241228 }
1225- HDC hdc = GetDC (m_hwndParent);
1226- int deviceYDPI = GetDeviceCaps (hdc, LOGPIXELSY );
1227- ReleaseDC (m_hwndParent, hdc);
1228- m_webviewController->SetBoundsAndZoomFactor (*lprcClipRect, 96.0 / deviceYDPI);
1229+ m_webviewController->SetBoundsAndZoomFactor (*lprcClipRect, 96.0 / g_deviceYDPI);
12291230 CopyRect (&m_webviewBounds, lprcClipRect);
12301231 return S_OK ;
12311232}
0 commit comments