Page 1 of 2

Webgadget IE compatibilty mode

Posted: Thu Aug 22, 2013 7:50 am
by Karellen

Code: Select all

If OpenWindow(0,0,0,800,600,"Webgadget",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  WebGadget(0,0,0,800,600,"http://whatismybrowser.com/")   
EndIf

Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Hi everyone,
running the code above gives me the following result:
Internet Explorer 10 on Windows 7
Internet Explorer 7 Compatibility View, 32 bit compatibility layer, Media Center PC v6.0
I have two questions about this:
  1. Can anybody explain me the reason the webgadget is running in IE 7 mode?
  • Can this be changed to display modern pages with html5/css3?
Thanks!

Re: Webgadget IE compatibilty mode

Posted: Thu Aug 22, 2013 10:23 am
by ostapas
Try this:

Code: Select all

RegCreateKeyValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", GetFilePart(ProgramFilename()), "10001", #REG_DWORD, ".")
Possible parameter values - http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Re: Webgadget IE compatibilty mode

Posted: Thu Aug 22, 2013 11:07 am
by Karellen
Works perfectly, thanks a lot, also for the link! :)

Re: Webgadget IE compatibilty mode

Posted: Sat Aug 31, 2013 1:05 am
by Nico
Exactly:

See MSDN: http://msdn.microsoft.com/en-us/library ... s.85).aspx

Registry path:

Code: Select all

32 bit:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

Value Key: yourapplication.exe

64 bit:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION

Value Key: yourapplication.exe
La valeur associée doit correspondre à ça:

Code: Select all

The value to set this key to is (taken from MSDN here) as decimal values:

10001 (0x2711)
Internet Explorer 10. Webpages are displayed in IE10 Standards mode, regardless of the !DOCTYPE directive.

10000 (0x02710)
Internet Explorer 10. Webpages containing standards-based !DOCTYPE directives are displayed in IE10 Standards mode. Default value for Internet Explorer 10.

9999 (0x270F) 
Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.

9000 (0x2328) 
Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.

8888 (0x22B8) 
Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive.

8000 (0x1F40) 
Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode.

7000 (0x1B58) 
Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode.

Re: Webgadget IE compatibilty mode

Posted: Sat Aug 31, 2013 1:14 am
by ts-soft
the 64-bit Key is only for 32-Bit programs on 64-bit OS, but not for 64-Bit programs on 64-bit OS :wink:

and it is not recommed to use the Wow6432Node-path directly, better use this:
http://www.purebasic.fr/english/viewtop ... 72#p422572

Re: Webgadget IE compatibilty mode

Posted: Sat Aug 31, 2013 4:45 am
by PB
> RegCreateKeyValue("HKEY_LOCAL_MACHINE\Software\ [...]

Don't forget this will need Admin rights to work.

Re: Webgadget IE compatibilty mode

Posted: Fri Jan 19, 2018 11:39 pm
by Tristano
This thread has been many times a useful reference to me, and helped me overcome the WebGadget limitation of old-browser behaviour, and enjoy some HTML5 in the WebGadget.

I'd like to keep it alive and add a few useful links on the topic, which have helped me further search the subject:
Also worth mentioning, that with RegCreateKeyEx for current user using REG_OPTION_VOLATILE for dwOptions allows to set browser compatiblity mode for the given executable without changing permanently the registry (and should not require high priviledges to run). Furthermore (unlike for local machine), the registry key under current user is the same for both 32 and 64 bit executables! (so no need to worry about bitness of app)

The registry key must be set before opening the WebGadget!

Code: Select all

LONG RegCreateKeyEx(
  HKEY hKey,                                    // handle of an open key  
  LPCTSTR lpSubKey,                             // address of subkey name  
  DWORD Reserved,                               // reserved  
  LPTSTR lpClass,                               // address of class string  
  DWORD dwOptions,                              // special options flag  
  REGSAM samDesired,                            // desired security access  
  LPSECURITY_ATTRIBUTES lpSecurityAttributes,   // address of key security structure  
  PHKEY phkResult,                              // address of buffer for opened handle  
  LPDWORD lpdwDisposition                       // address of disposition value buffer  
); 
From MS documentation:
dwOptions — Specifies special options for the key. This parameter can be one of the following values:

[...]

REG_OPTION_VOLATILE — Windows NT: This key is volatile; the information is stored in memory and is not preserved when the system is restarted. The RegSaveKey function does not save volatile keys. This flag is ignored if the key already exists.
Nowadays, the ideal value of the compatibility mode is 11001 (aka Edge mode), which will use the highest browser version available on the machine (ie: IE11 on all modern Windows). Other values don't make much sense probably.

Re: Webgadget IE compatibilty mode

Posted: Tue Nov 13, 2018 5:41 pm
by Kukulkan
Hello Tristano,

do you have a final path for the needed registry entry and, maybe, a PB example about how you set this value?

Thanks!

Re: Webgadget IE compatibilty mode

Posted: Tue Nov 13, 2018 9:14 pm
by idle

Code: Select all

Procedure SetFeature_Browser_Emulation() 
  Protected lpValueName.s,lpData.l,phkResult,lpsdata.s
  lpValueName.s = GetFilePart(ProgramFilename()) 
  lpData = 11001  
  If RegCreateKeyEx_(#HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", 0, #Null, #REG_OPTION_VOLATILE, #KEY_ALL_ACCESS, #Null, @phkResult, @lpdwDisposition) = #ERROR_SUCCESS
    RegSetValueEx_(phkResult, lpValueName, 0, #REG_DWORD, @lpData, SizeOf(LONG))
    RegCloseKey_(phkResult)
  EndIf
    
EndProcedure 

Procedure DelFeature_Browser_Emulation() 
  Protected phkResult,lpValueName.s  
  lpValueName.s = GetFilePart(ProgramFilename()) 
  If RegOpenKeyEx_(#HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", 0, #KEY_SET_VALUE, @phkResult) = #ERROR_SUCCESS
    RegDeleteValue_(phkResult, lpValueName)
    RegCloseKey_(phkResult)
  EndIf
EndProcedure 

Re: Webgadget IE compatibilty mode

Posted: Tue Nov 13, 2018 10:06 pm
by Dude
This thread should be made Sticky.

Re: Webgadget IE compatibilty mode

Posted: Wed Nov 14, 2018 9:02 am
by Kukulkan
Hi idle,

thank you very much! Great!

Is there any experience about the reliability of this hack? If I want to roll out such for thousands of users, how big is the chance that other software manipulates the same key at the same time and how often does this happen?

Best,

Kukulkan

Re: Webgadget IE compatibilty mode

Posted: Wed Nov 14, 2018 9:20 am
by Dude
Kukulkan wrote:If I want to roll out such for thousands of users, how big is the chance that other software manipulates the same key at the same time and how often does this happen?
Bisonte answered this exact question for me here:

viewtopic.php?p=528529#p528529

There's no clashing with other software. :)

Re: Webgadget IE compatibilty mode

Posted: Wed Nov 14, 2018 9:33 am
by Kukulkan
Great! Thanks! I just checked the code and yes, it enters the executable name. Therefore, it should not apply to others and others should not affect me. Perfect!

Re: Webgadget IE compatibilty mode

Posted: Wed Nov 14, 2018 9:46 am
by idle
Kukulkan wrote:Hi idle,

thank you very much! Great!

Is there any experience about the reliability of this hack? If I want to roll out such for thousands of users, how big is the chance that other software manipulates the same key at the same time and how often does this happen?

Best,

Kukulkan
It's the Microsoft official solution, it's not ideal but at least it set your application name, so yes it's safe
HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
SOFTWARE
Microsoft
Internet Explorer
Main
FeatureControl
FEATURE_BROWSER_EMULATION
YourApplication.exe = (DWORD) 00011001

Re: Webgadget IE compatibilty mode

Posted: Wed Nov 14, 2018 9:54 am
by Dude
Kukulkan wrote: yes, it enters the executable name
Yep. Just don't name your executable "calc.exe" or "notepad.exe" :lol: