PDA

View Full Version : مشکل با DWORD 11001 در شبیه سازی Web Browser سی شارپ



cmsdqq2
شنبه 28 مهر 1397, 15:44 عصر
دوستان سلام

میدونیم که یک سری از وب سایت ها با نسخه web browser که در سی شارپ هست کار نمیکنن و میگن که باید مرورگر رو آپدیت کنین.

برای این کار هم از طریق رجیستری میایم و نسخه شبیه ساز رو افزایش میدیم.

من از این تابع استفاده میکنم اما همچنان با google map این مشکل رو دارم.

البته تا چند روز پیش درست بود و همین تابع کار رو راه مینداخت اما یه چند روزی هست که نمیشه.

****** وقتی که ie 11 رو روی win7 x86 نصب میکنم، حل میشه. *****




private void SetIE11KeyforWebBrowserControl()
{
var appName = Process.GetCurrentProcess().ProcessName + ".exe";
RegistryKey Regkey = null;
try
{
// For 64 bit machine
if (Environment.Is64BitOperatingSystem)
Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@ "SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EM ULATION", true);
else //For 32 bit machine
Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@ "SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EM ULATION", true);


// If the path is not correct or
// if the user haven't priviledges to access the registry
if (Regkey == null)
{
if (Environment.Is64BitOperatingSystem)
Regkey = Microsoft.Win32.Registry.LocalMachine.CreateSubKey (@"SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EM ULATION");
else //For 32 bit machine
Regkey = Microsoft.Win32.Registry.LocalMachine.CreateSubKey (@"SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EM ULATION");
}


string FindAppkey = Convert.ToString(Regkey.GetValue(appName));


// Check if key is already present
if (FindAppkey == "11000")
{
Regkey.Close();
//MessageBox.Show("Application set IE Key value");
return;
}
else
{
Regkey.SetValue(appName, unchecked((int)0x2AF8), RegistryValueKind.DWord);
}


// Check for the key after adding
FindAppkey = Convert.ToString(Regkey.GetValue(appName));


if (FindAppkey != "11000")
throw new Exception("Can not set IE key for web browser");
else
{
Regkey.Close();
//MessageBox.Show("Application set IE Key value");
}
}
catch (Exception ex)
{
MessageBox.Show("Application Settings Failed\n" + ex.Message);
}
finally
{
// Close the Registry
if (Regkey != null)
Regkey.Close();
}
}





از این کلاس هم استفاده کردم اما نتیجه ای نگرفتم.



public class Helper
{
public static void SetBrowserEmulation(
string programName, IE browserVersion)
{
if (string.IsNullOrEmpty(programName))
{
programName = AppDomain.CurrentDomain.FriendlyName;
RegistryKey regKey = Registry.CurrentUser.OpenSubKey(
"Software\\Microsoft\\Internet Explorer\\Main" +
"\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
if (regKey != null)
{
try
{
regKey.SetValue(programName, browserVersion,
RegistryValueKind.DWord);
}
catch (Exception ex)
{
throw new Exception("Error writing to the registry", ex);
}
}
else
{
try
{
regKey = Registry.CurrentUser.OpenSubKey("Software" +
"\\Microsoft\\Internet Explorer\\Main" +
"\\FeatureControl", true);
regKey.CreateSubKey("FEATURE_BROWSER_EMULATION");
regKey.SetValue(programName, browserVersion,
RegistryValueKind.DWord);
}
catch (Exception ex)
{
throw new Exception("Error accessing the registry", ex);
}
}
}
}
}


public enum IE
{
IE7 = 7000,
IE8 = 8000,
IE8StandardsMode = 8888,
IE9 = 9000,
IE9StandardsMode = 9999,
IE10 = 10000,
IE10StandardsMode = 10001
}

cmsdqq2
شنبه 28 مهر 1397, 18:31 عصر
دوستان نظری دارید؟

cmsdqq2
چهارشنبه 02 آبان 1397, 22:21 عصر
مدیران و دوستان عزیز، پیشنهادی ندارین؟

cmsdqq2
دوشنبه 14 آبان 1397, 01:48 صبح
این سوال در stackoverflow هم منتشر شده. دوستان با توجه به حرف هایی که stack زده شده، چه پیشنهادی دارین؟

لینک: https://stackoverflow.com/questions/53044268/c-sharp-version-of-web-browser-warning-when-using-google-map-windows-7-and-int?noredirect=1#comment93104466_53044268