Skip to content

Commit

Permalink
adjust FEATURE_BROWSER_EMULATION to IE version
Browse files Browse the repository at this point in the history
  • Loading branch information
katahiromz committed May 11, 2019
1 parent 9ee634b commit 319fd5d
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ static std::wstring s_strCurPage;

LPTSTR LoadStringDx(INT nID);

BOOL GetIEVersion(LPWSTR pszVersion, DWORD cchVersionMax)
{
pszVersion[0] = 0;
HKEY hKey = NULL;
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Internet Explorer", 0,
KEY_READ, &hKey);
if (hKey)
{
DWORD cb = cchVersionMax * sizeof(WCHAR);
LONG ret = RegQueryValueExW(hKey, L"svcVersion", NULL, NULL, (LPBYTE)pszVersion, &cb);
if (ret != ERROR_SUCCESS)
{
ret = RegQueryValueExW(hKey, L"Version", NULL, NULL, (LPBYTE)pszVersion, &cb);
}
RegCloseKey(hKey);

return ret == ERROR_SUCCESS;
}

return FALSE;
}


void SETTINGS::reset()
{
m_x = CW_USEDEFAULT;
Expand All @@ -34,7 +57,40 @@ void SETTINGS::reset()
m_kiosk_mode = FALSE;
m_no_virus_scan = FALSE;
m_zone_ident = TRUE;
m_emulation = 11001;

// FEATURE_BROWSER_EMULATION
m_emulation = 0;
WCHAR szVersion[32];
if (GetIEVersion(szVersion, ARRAYSIZE(szVersion)))
{
if (szVersion[1] == L'.')
{
switch (szVersion[0])
{
case '7':
m_emulation = 7000;
break;
case '8':
m_emulation = 8888;
break;
case '9':
m_emulation = 9999;
break;
}
}
else if (szVersion[2] == L'.')
{
if (szVersion[0] == L'1' && szVersion[1] == L'0')
{
m_emulation = 10001;
}
if (szVersion[0] == L'1' && szVersion[1] == L'1')
{
m_emulation = 11001;
}
}
}

m_refresh_interval = (30 * 1000); // 30 seconds
m_play_sound = TRUE;
}
Expand Down

0 comments on commit 319fd5d

Please sign in to comment.