Get Internet Explorer version: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.)
(Added References links)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|sunjammer}}
|<small>Author: [[{{ns:2}}:sunjammer|sunjammer]] ([[{{ns:3}}:sunjammer|talk]], [[{{ns:-1}}:Contributions/sunjammer|contrib]])</small>
 
|}
<br style="clear:both;">
== Description ==
== Description ==
This function gets the major version of Microsoft Internet Explorer the user uses.
This function gets the major version of Microsoft Internet Explorer.


== The Function ==
== The Function ==
Line 10: Line 8:
; GetIEVersion
; GetIEVersion
;
;
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
; Based on Yazno's function, http://yazno.tripod.com/
; Updated 2007-06-02 Ch. Bergmann (Yazno)
; Returns on top of stack
; Returns on top of stack
; 1-6 (Installed IE Version)
; 1-11 (Installed IE Version)
; or
; or
; '' (IE is not installed)
; '' (IE is not installed)
Line 23: Line 22:
Function GetIEVersion
Function GetIEVersion
   Push $R0
   Push $R0
  ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "svcVersion" ; IE v10+
  StrCpy $R0 $R0 2
  IntCmp $R0 9 "" "" lbl_done
   ClearErrors
   ClearErrors
   ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "Version"
   ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "Version"
   IfErrors lbl_123 lbl_456
   IfErrors lbl_123 lbl_4567


   lbl_456: ; ie 4+
   lbl_4567: ; IE v4..9
     Strcpy $R0 $R0 1
     Strcpy $R0 $R0 1
   Goto lbl_done
   Goto lbl_done


   lbl_123: ; older ie version
   lbl_123: ; IE v1..3
     ClearErrors
     ClearErrors
     ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "IVer"
     ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "IVer"
Line 53: Line 55:
   Exch $R0
   Exch $R0
FunctionEnd</highlight-nsis>
FunctionEnd</highlight-nsis>
== References ==
* [https://web.archive.org/web/20041109040735/http://support.microsoft.com/kb/164539 KB 164539: How to determine which version of Internet Explorer is installed]
* [https://www.codeproject.com/articles/1583/determine-the-version-of-internet-explorer-install Codeproject: Determine the version of Internet Explorer installed]
[[Category:Other Products Version Detection Functions]]

Latest revision as of 13:38, 1 May 2020

Author: sunjammer (talk, contrib)


Description

This function gets the major version of Microsoft Internet Explorer.

The Function

; GetIEVersion
;
; Based on Yazno's function, http://yazno.tripod.com/
; Updated 2007-06-02 Ch. Bergmann (Yazno)
; Returns on top of stack
; 1-11 (Installed IE Version)
; or
; '' (IE is not installed)
;
; Usage:
;   Call GetIEVersion
;   Pop $R0
;   ; at this point $R0 is "5" or whatnot
 
Function GetIEVersion
  Push $R0
  ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "svcVersion" ; IE v10+
  StrCpy $R0 $R0 2
  IntCmp $R0 9 "" "" lbl_done
  ClearErrors
  ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "Version"
  IfErrors lbl_123 lbl_4567
 
  lbl_4567: ; IE v4..9
    Strcpy $R0 $R0 1
  Goto lbl_done
 
  lbl_123: ; IE v1..3
    ClearErrors
    ReadRegStr $R0 HKLM "Software\Microsoft\Internet Explorer" "IVer"
    IfErrors lbl_error
 
      StrCpy $R0 $R0 3
        StrCmp $R0 '100' lbl_ie1
        StrCmp $R0 '101' lbl_ie2
        StrCmp $R0 '102' lbl_ie2
        StrCpy $R0 '3' ; default to ie3 if not 100, 101, or 102.
        Goto lbl_done
          lbl_ie1:
            StrCpy $R0 '1'
          Goto lbl_done
          lbl_ie2:
            StrCpy $R0 '2'
          Goto lbl_done
       lbl_error:
         StrCpy $R0 ''
   lbl_done:
   Exch $R0
FunctionEnd

References