Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web browser control - disable IE7 emulation
#1
Function WebBrowserControlDisableIE7Emulation
Code:
Copy      Help
;/
function [flags] ;;flags: 1 for all users

;Ensures that web browser controls of this program (qm.exe or qmmacro.exe or your QM-created exe) can use features of current Internet Explorer version (CSS3, HTML5 etc).

;REMARKS
;By default, web browser controls work in compatibility mode with Internet Explorer 7. IE 8/9/10/11 features are unavailable.
;This function sets this registry value, if it is missing or different:
;;;SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION:<ThisProgram.exe>=<CurrentInternetExplorerVersion>
;By default sets its only for current user, in HKEY_CURRENT_USER. If flag 1, sets for all users, in HKEY_LOCAL_MACHINE; then error if this process is not running as administrator.
;You can call this function before ShowDialog if the dialog contains an ActiveX control SHDocVw.WebBrowser. Or call it once.


if(_iever<8) ret
str e.getfilename(ExeFullPath 1)
;out e
int t v=_iever>>8*1000
;out v
int h=iif(flags&1 HKEY_LOCAL_MACHINE HKEY_CURRENT_USER)
lpstr k="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
if(rget(t e k h) and t=v) ret
;out t
if(!rset(v e k h)) end ERR_ADMIN
#2
I hope to integrate this function into the software.  Smile
#3
A small sidenote (not important if you do not have any issues):

If you want to disable this function  WebBrowserControlDisableIE7Emulation  then:

1. Disable the line WebBrowserControlDisableIE7Emulation 
2. Remove the 'qm.exe' (registry value, not the data/content) from

   - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
   - HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION

    In my case, the qm.exe only showed up in HKEY_CURRENT_USER

[Image: 1.jpg]

3. restart qm and then re-run the script/dialog/...

If you want to re-enable it just enable the line WebBrowserControlDisableIE7Emulation and run the script/dialog/...
(If you do not see any effect after enabling the line, then restart QM and then re-run the script/dialog/ with the line activated)


Some backstory on this.
I was working with the SHDocVw.WebBrowser control but a webpage kept showing blank while it previously worked when the above function was used. I found out that qm "remembers" it's previous compatibility-mode-state even when you run the above function.
So I ran the dialog script with the WebBrowserControlDisableIE7Emulation activated then restarted QM and then start the dialog again.
To turn WebBrowserControlDisableIE7Emulation off I did the above mentioned 3 steps.

Normally the script works immediately when you activate the line WebBrowserControlDisableIE7Emulation and then run your script/dialog/... but if it doesn't try restarting QM and rerun your script/dialog....

Maybe this is of use for someone... (I don't know, I just thought I mention it)


Forum Jump:


Users browsing this thread: 2 Guest(s)