webbrowser using ie10 c# winform -
i want force webbrowser use ie10 in c# winform application. know there other questions i've read lot of them , don't know i'm wrong.
this code:
registrykey registrybrowser = registry.localmachine.opensubkey (@"software\microsoft\internet explorer\main\featurecontrol\feature_browser_emulation", true); registrybrowser.setvalue("myappname", 0x02710, registryvaluekind.dword); //even qword
i've tried different ways set value like:
registrybrowser.setvalue("myappname", 1000, registryvaluekind.dword); //even qword , string registrybrowser.setvalue("myappname", 1000); //even 0x02710
i write in costructor of main project before initializecomponent(). i've got admin permission set in .manifest file
thanks all, blackshawarna
edit: discovered registrykey.setvalue(...); created key in path:
(@"software\wow6432node\microsoft\internet explorer\main\featurecontrol\feature_browser_emulation")
even if instruction said: registry.localmachine.opensubkey (@"software\microsoft\internet explorer\main\featurecontrol\feature_browser_emulation", true);
i think happens because ie10 works on 32bit mode. don't understand why writes in path if specified 1 and, above all, why application doesn't work if open registry.localmachine.opensubkey(@"software\wow6432node....");
if run program in x64 mode, going properties/build/x64, won't write key in original path.
i had same problem app wrote value "hkey_local_machine\software\wow6432node\microsoft\internet explorer\main\featurecontrol\feature_browser_emulation".
i changed localmachine currentuser , works.
string executablepath = environment.getcommandlineargs()[0]; string executablename = system.io.path.getfilename(executablepath); registrykey registrybrowser = registry.currentuser.opensubkey (@"software\microsoft\internet explorer\main\featurecontrol\feature_browser_emulation", true); if (registrybrowser == null) { registrykey registryfolder = registry.currentuser.opensubkey (@"software\microsoft\internet explorer\main\featurecontrol", true); registrybrowser = registryfolder.createsubkey("feature_browser_emulation"); } registrybrowser.setvalue(executablename, 0x02710, registryvaluekind.dword); registrybrowser.close();
the executablename "myappname.exe"
note: if webbrowser controls inside dll need specify hosting exe's name whatever might be, eg system.appdomain.currentdomain.friendlyname
Comments
Post a Comment