Results 1 to 6 of 6

Thread: VB6 does not use IE core browser

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    VB6 does not use IE core browser

    I use VB6 test to open the website. It's normal in IDE, but it's OK after compiling. It seems that the IE version I called doesn't support it.

    So my question is: can I not use IE, or force to use the latest ie version of the system?
    QQ: 289778005

  2. #2
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    439

    Re: VB6 does not use IE core browser

    hi, you need to write your application name.exe in the registry in the following key, this should be done before loading the web browser, call a function similar to this in the initialize or sub main.

    in the forum there is more information.

    HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"

    Code:
    Private Function GetEXEName() As String
        Const MAX_PATH = 260&
        GetEXEName = Space$(MAX_PATH - 1&)
        GetEXEName = Left$(GetEXEName, GetModuleFileNameW(0&, StrPtr(GetEXEName), MAX_PATH))
        GetEXEName = Right$(GetEXEName, Len(GetEXEName) - InStrRev(GetEXEName, "\"))
    End Function
    
    
    Sub WebBrowser_IE9()
        Dim Ret As Long, RegistryKey As Long
        Dim sBuffer As String
        Dim ExeName As String
        
        ExeName = GetEXEName()
        'Enable HTML5
        Call RegCreateKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", RegistryKey)
        sBuffer = Space(255)
        Ret = RegQueryValueEx(RegistryKey, ExeName, 0, REG_DWORD, ByVal sBuffer, 255&)
        If Ret <> 0 Then RegSetValueEx RegistryKey, ExeName, 0&, REG_DWORD, 0&, 4&
        Call RegCloseKey(RegistryKey)
        
        'Enable GPU Renderin
        Call RegCreateKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_GPU_RENDERING", RegistryKey)
        sBuffer = Space(255)
        Ret = RegQueryValueEx(RegistryKey, ExeName, 0, REG_DWORD, ByVal sBuffer, 255&)
        If Ret <> 0 Then RegSetValueEx RegistryKey, ExeName, 0&, REG_DWORD, 1&, 4&
        Call RegCloseKey(RegistryKey)
        
        'Scale DPI
        'Call RegCreateKey(HKEY_CURRENT_USER, "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_96DPI_PIXEL", RegistryKey)
        'sBuffer = Space(255)
        'Ret = RegQueryValueEx(RegistryKey, ExeName, 0, REG_DWORD, ByVal sBuffer, 255&)
        'If Ret <> 0 Then RegSetValueEx RegistryKey, ExeName, 0&, REG_DWORD, 1&, 4&
        'Call RegCloseKey(RegistryKey)
        
    End Sub
    leandroascierto.com Visual Basic 6 projects

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 does not use IE core browser

    Thank you LeandroA! Now it works normally after compiling in IE 11 or above. I am testing whether this method is also applicable to vb.net, because I opened it with vb.net before that is also abnormal.
    QQ: 289778005

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 does not use IE core browser

    Now it is found that mouse movement and click events do not respond. Is this a problem of the registry?

    I tested this website:

    https://www.echartsjs.com/examples/z...c=dataset-link
    Last edited by ChenLin; Mar 15th, 2020 at 07:05 PM.
    QQ: 289778005

  5. #5
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 does not use IE core browser

    I have no problem with the link you've posted, when trying it with the IE-Control (on Win10) -
    but I'm using a somewhat more "elaborate" Class (cIEFeatures.cls) which was build already some years ago,
    and which ensures quite a lot of "reasonable defaults".

    Here's my most recent version (enhanced about a few newer Properties in the recent months):

    Code:
    Option Explicit 'cIEFeatures  (Olaf Schmidt, 2014)
    
    'this Class has built-in IE-feature-control according to:  http://msdn.microsoft.com/en-us/library/ee330733%28v=vs.85%29.aspx
    Const FeaturePageSetup As String = "HKCU\Software\Microsoft\Internet Explorer\PageSetup\"
    Const FeatureBaseKey As String = "HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\"
    Private Declare Function GetModuleFileNameA Lib "kernel32" (ByVal hModule As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
     
    Private Sh As Object, mExeName As String, mInstalledVersion As String
    
    Private Sub Class_Initialize()
      Set Sh = CreateObject("WScript.Shell")
     
      mExeName = Space$(260)
      mExeName = Left$(mExeName, GetModuleFileNameA(0, mExeName, Len(mExeName)))
      mExeName = Mid$(mExeName, InStrRev(mExeName, "\") + 1)
      
      If FEATURE_BROWSER_EMULATION = 7000 Then  'in this case it is not elevated yet - and we ensure new elevated Defaults
         FEATURE_ENABLE_WEB_CONTROL_VISUALS = 1
         FEATURE_RESTRICT_ACTIVEXINSTALL = 1
         FEATURE_ADDON_MANAGEMENT = 1
         FEATURE_ZONE_ELEVATION = 0
         FEATURE_AJAX_CONNECTIONEVENTS = 1
         FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION = 1
         FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS = 0
         FEATURE_MIME_HANDLING = 1
         FEATURE_DOMSTORAGE = 1
         FEATURE_GPU_RENDERING = 1      ' testen
         FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI = 0 ' testen
         FEATURE_NINPUT_LEGACYMODE = 0
         FEATURE_DISABLE_LEGACY_COMPRESSION = 1
         FEATURE_LOCALMACHINE_LOCKDOWN = 0
         FEATURE_BLOCK_LMZ_OBJECT = 0
         FEATURE_BLOCK_LMZ_SCRIPT = 0
         FEATURE_DISABLE_NAVIGATION_SOUNDS = 1
         FEATURE_SCRIPTURL_MITIGATION = 1
         FEATURE_SPELLCHECKING = 1
         FEATURE_STATUS_BAR_THROTTLING = 1
         FEATURE_TABBED_BROWSING = 1
         FEATURE_VALIDATE_NAVIGATE_URL = 1
         FEATURE_WEBOC_DOCUMENT_ZOOM = 1
         FEATURE_WEBOC_POPUPMANAGEMENT = 0
         FEATURE_WEBOC_MOVESIZECHILD = 1
         FEATURE_WEBSOCKET = 1
         FEATURE_WINDOW_RESTRICTIONS = 0
         FEATURE_XMLHTTP = 1
         FEATURE_96DPI_PIXEL = 1
      End If
    End Sub
    
    Public Property Get ExeName() As String
      ExeName = mExeName
    End Property
     
    Public Property Get InstalledVersion() As String
      On Error Resume Next
        InstalledVersion = Sh.RegRead("HKLM\Software\Microsoft\Internet Explorer\svcVersion")
        If Len(InstalledVersion) = 0 Then mInstalledVersion = Sh.RegRead("HKLM\Software\Microsoft\Internet Explorer\Version")
        If Len(InstalledVersion) = 0 Then mInstalledVersion = 7 'let's assume that as a fallback, since it's the default-emulation for a Browser-Control
      If Err Then Err.Clear
    End Property
     
    Public Sub WriteFeature(FeatureKey As String, ByVal Value, Optional ValueType As String = "REG_DWORD")
      Sh.RegWrite FeatureBaseKey & FeatureKey & "\" & mExeName, Value, ValueType
    End Sub
    Public Function ReadFeature(FeatureKey As String, Optional ByVal Default)
      On Error Resume Next
        ReadFeature = Sh.RegRead(FeatureBaseKey & FeatureKey & "\" & mExeName)
        If Err Then
          If Not IsEmpty(Default) And FeatureKey <> "FEATURE_BROWSER_EMULATION" Then WriteFeature FeatureKey, Default
          ReadFeature = Default
        End If
      On Error GoTo 0
    End Function
    
    Public Property Get FEATURE_BROWSER_EMULATION() As Long
      FEATURE_BROWSER_EMULATION = ReadFeature("FEATURE_BROWSER_EMULATION", 7000)
    End Property
    Public Property Let FEATURE_BROWSER_EMULATION(ByVal Version As Long)
      If Version < 7 Then Version = 7
      If Version < 1000 Then Version = Version * 1000
      WriteFeature "FEATURE_BROWSER_EMULATION", Version
    End Property
     
    Public Property Get FEATURE_ENABLE_WEB_CONTROL_VISUALS()
      FEATURE_ENABLE_WEB_CONTROL_VISUALS = ReadFeature("FEATURE_ENABLE_WEB_CONTROL_VISUALS", 1)
    End Property
    Public Property Let FEATURE_ENABLE_WEB_CONTROL_VISUALS(ByVal Value)
      WriteFeature "FEATURE_ENABLE_WEB_CONTROL_VISUALS", Value
    End Property
     
    Public Property Get FEATURE_RESTRICT_ACTIVEXINSTALL()
      FEATURE_RESTRICT_ACTIVEXINSTALL = ReadFeature("FEATURE_RESTRICT_ACTIVEXINSTALL", 1)
    End Property
    Public Property Let FEATURE_RESTRICT_ACTIVEXINSTALL(ByVal Value)
      WriteFeature "FEATURE_RESTRICT_ACTIVEXINSTALL", Value
    End Property
    
    Public Property Get FEATURE_ADDON_MANAGEMENT()
      FEATURE_ADDON_MANAGEMENT = ReadFeature("FEATURE_ADDON_MANAGEMENT", 0)
    End Property
    Public Property Let FEATURE_ADDON_MANAGEMENT(ByVal Value)
      WriteFeature "FEATURE_ADDON_MANAGEMENT", Value
    End Property
    
    Public Property Get FEATURE_ZONE_ELEVATION()
      FEATURE_ZONE_ELEVATION = ReadFeature("FEATURE_ZONE_ELEVATION", 1)
    End Property
    Public Property Let FEATURE_ZONE_ELEVATION(ByVal Value)
      WriteFeature "FEATURE_ZONE_ELEVATION", Value
    End Property
    
    Public Property Get FEATURE_AJAX_CONNECTIONEVENTS()
      FEATURE_AJAX_CONNECTIONEVENTS = ReadFeature("FEATURE_AJAX_CONNECTIONEVENTS", 1)
    End Property
    Public Property Let FEATURE_AJAX_CONNECTIONEVENTS(ByVal Value)
      WriteFeature "FEATURE_AJAX_CONNECTIONEVENTS", Value
    End Property
    
    Public Property Get FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION()
      FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION = ReadFeature("FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION", 1)
    End Property
    Public Property Let FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION(ByVal Value)
      WriteFeature "FEATURE_ENABLE_CLIPCHILDREN_OPTIMIZATION", Value
    End Property
    
    Public Property Get FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS()
      FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS = ReadFeature("FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS", 1)
    End Property
    Public Property Let FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS(ByVal Value)
      WriteFeature "FEATURE_MANAGE_SCRIPT_CIRCULAR_REFS", Value
    End Property
    
    Public Property Get FEATURE_MIME_HANDLING()
      FEATURE_MIME_HANDLING = ReadFeature("FEATURE_MIME_HANDLING", 1)
    End Property
    Public Property Let FEATURE_MIME_HANDLING(ByVal Value)
      WriteFeature "FEATURE_MIME_HANDLING", Value
    End Property
    
    Public Property Get FEATURE_DOMSTORAGE()
      FEATURE_DOMSTORAGE = ReadFeature("FEATURE_DOMSTORAGE", 1)
    End Property
    Public Property Let FEATURE_DOMSTORAGE(ByVal Value)
      WriteFeature "FEATURE_DOMSTORAGE", Value
    End Property
    
    Public Property Get FEATURE_GPU_RENDERING()
      FEATURE_GPU_RENDERING = ReadFeature("FEATURE_GPU_RENDERING", 1)
    End Property
    Public Property Let FEATURE_GPU_RENDERING(ByVal Value)
      WriteFeature "FEATURE_GPU_RENDERING", Value
    End Property
    
    Public Property Get FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI()
      FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI = ReadFeature("FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI", 0)
    End Property
    Public Property Let FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI(ByVal Value)
      WriteFeature "FEATURE_IVIEWOBJECTDRAW_DMLT9_WITH_GDI", Value
    End Property
    
    Public Property Get FEATURE_NINPUT_LEGACYMODE()
      FEATURE_NINPUT_LEGACYMODE = ReadFeature("FEATURE_NINPUT_LEGACYMODE", 0)
    End Property
    Public Property Let FEATURE_NINPUT_LEGACYMODE(ByVal Value)
      WriteFeature "FEATURE_NINPUT_LEGACYMODE", Value
    End Property
    
    Public Property Get FEATURE_DISABLE_LEGACY_COMPRESSION()
      FEATURE_DISABLE_LEGACY_COMPRESSION = ReadFeature("FEATURE_DISABLE_LEGACY_COMPRESSION", 1)
    End Property
    Public Property Let FEATURE_DISABLE_LEGACY_COMPRESSION(ByVal Value)
      WriteFeature "FEATURE_DISABLE_LEGACY_COMPRESSION", Value
    End Property
    
    Public Property Get FEATURE_LOCALMACHINE_LOCKDOWN()
      FEATURE_LOCALMACHINE_LOCKDOWN = ReadFeature("FEATURE_LOCALMACHINE_LOCKDOWN", 0)
    End Property
    Public Property Let FEATURE_LOCALMACHINE_LOCKDOWN(ByVal Value)
      WriteFeature "FEATURE_LOCALMACHINE_LOCKDOWN", Value
    End Property
    
    Public Property Get FEATURE_BLOCK_LMZ_OBJECT()
      FEATURE_BLOCK_LMZ_OBJECT = ReadFeature("FEATURE_BLOCK_LMZ_OBJECT", 0)
    End Property
    Public Property Let FEATURE_BLOCK_LMZ_OBJECT(ByVal Value)
      WriteFeature "FEATURE_BLOCK_LMZ_OBJECT", Value
    End Property
    
    Public Property Get FEATURE_BLOCK_LMZ_SCRIPT()
      FEATURE_BLOCK_LMZ_SCRIPT = ReadFeature("FEATURE_BLOCK_LMZ_SCRIPT", 0)
    End Property
    Public Property Let FEATURE_BLOCK_LMZ_SCRIPT(ByVal Value)
      WriteFeature "FEATURE_BLOCK_LMZ_SCRIPT", Value
    End Property
    
    Public Property Get FEATURE_DISABLE_NAVIGATION_SOUNDS()
      FEATURE_DISABLE_NAVIGATION_SOUNDS = ReadFeature("FEATURE_DISABLE_NAVIGATION_SOUNDS", 1)
    End Property
    Public Property Let FEATURE_DISABLE_NAVIGATION_SOUNDS(ByVal Value)
      WriteFeature "FEATURE_DISABLE_NAVIGATION_SOUNDS", Value
    End Property
    
    Public Property Get FEATURE_SCRIPTURL_MITIGATION()
      FEATURE_SCRIPTURL_MITIGATION = ReadFeature("FEATURE_SCRIPTURL_MITIGATION", 1)
    End Property
    Public Property Let FEATURE_SCRIPTURL_MITIGATION(ByVal Value)
      WriteFeature "FEATURE_SCRIPTURL_MITIGATION", Value
    End Property
    
    Public Property Get FEATURE_SPELLCHECKING()
      FEATURE_SPELLCHECKING = ReadFeature("FEATURE_SPELLCHECKING", 1)
    End Property
    Public Property Let FEATURE_SPELLCHECKING(ByVal Value)
      WriteFeature "FEATURE_SPELLCHECKING", Value
    End Property
    
    Public Property Get FEATURE_STATUS_BAR_THROTTLING()
      FEATURE_STATUS_BAR_THROTTLING = ReadFeature("FEATURE_STATUS_BAR_THROTTLING", 1)
    End Property
    Public Property Let FEATURE_STATUS_BAR_THROTTLING(ByVal Value)
      WriteFeature "FEATURE_STATUS_BAR_THROTTLING", Value
    End Property
    
    Public Property Get FEATURE_TABBED_BROWSING()
      FEATURE_TABBED_BROWSING = ReadFeature("FEATURE_TABBED_BROWSING", 1)
    End Property
    Public Property Let FEATURE_TABBED_BROWSING(ByVal Value)
      WriteFeature "FEATURE_TABBED_BROWSING", Value
    End Property
    
    Public Property Get FEATURE_VALIDATE_NAVIGATE_URL()
      FEATURE_VALIDATE_NAVIGATE_URL = ReadFeature("FEATURE_VALIDATE_NAVIGATE_URL", 1)
    End Property
    Public Property Let FEATURE_VALIDATE_NAVIGATE_URL(ByVal Value)
      WriteFeature "FEATURE_VALIDATE_NAVIGATE_URL", Value
    End Property
    
    Public Property Get FEATURE_WEBOC_DOCUMENT_ZOOM()
      FEATURE_WEBOC_DOCUMENT_ZOOM = ReadFeature("FEATURE_WEBOC_DOCUMENT_ZOOM", 1)
    End Property
    Public Property Let FEATURE_WEBOC_DOCUMENT_ZOOM(ByVal Value)
      WriteFeature "FEATURE_WEBOC_DOCUMENT_ZOOM", Value
    End Property
    
    Public Property Get FEATURE_WEBOC_POPUPMANAGEMENT()
      FEATURE_WEBOC_POPUPMANAGEMENT = ReadFeature("FEATURE_WEBOC_POPUPMANAGEMENT", 1)
    End Property
    Public Property Let FEATURE_WEBOC_POPUPMANAGEMENT(ByVal Value)
      WriteFeature "FEATURE_WEBOC_POPUPMANAGEMENT", Value
    End Property
    
    Public Property Get FEATURE_WEBOC_MOVESIZECHILD()
      FEATURE_WEBOC_MOVESIZECHILD = ReadFeature("FEATURE_WEBOC_MOVESIZECHILD", 0)
    End Property
    Public Property Let FEATURE_WEBOC_MOVESIZECHILD(ByVal Value)
      WriteFeature "FEATURE_WEBOC_MOVESIZECHILD", Value
    End Property
    
    Public Property Get FEATURE_WEBSOCKET()
      FEATURE_WEBSOCKET = ReadFeature("FEATURE_WEBSOCKET", 1)
    End Property
    Public Property Let FEATURE_WEBSOCKET(ByVal Value)
      WriteFeature "FEATURE_WEBSOCKET", Value
    End Property
    
    Public Property Get FEATURE_WINDOW_RESTRICTIONS()
      FEATURE_WINDOW_RESTRICTIONS = ReadFeature("FEATURE_WINDOW_RESTRICTIONS", 1)
    End Property
    Public Property Let FEATURE_WINDOW_RESTRICTIONS(ByVal Value)
      WriteFeature "FEATURE_WINDOW_RESTRICTIONS", Value
    End Property
    
    Public Property Get FEATURE_XMLHTTP()
      FEATURE_XMLHTTP = ReadFeature("FEATURE_XMLHTTP", 1)
    End Property
    Public Property Let FEATURE_XMLHTTP(ByVal Value)
      WriteFeature "FEATURE_XMLHTTP", Value
    End Property
    
    Public Property Get FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION()
      FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION = ReadFeature("FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION", 1)
    End Property
    Public Property Let FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION(ByVal Value)
      WriteFeature "FEATURE_BLOCK_CROSS_PROTOCOL_FILE_NAVIGATION", Value
    End Property
    
    Public Property Get FEATURE_RESTRICT_FILEDOWNLOAD()
      FEATURE_RESTRICT_FILEDOWNLOAD = ReadFeature("FEATURE_RESTRICT_FILEDOWNLOAD", 1)
    End Property
    Public Property Let FEATURE_RESTRICT_FILEDOWNLOAD(ByVal Value)
      WriteFeature "FEATURE_RESTRICT_FILEDOWNLOAD", Value
    End Property
     
    Public Property Get FEATURE_MAXCONNECTIONSPERSERVER()
      FEATURE_MAXCONNECTIONSPERSERVER = ReadFeature("FEATURE_MAXCONNECTIONSPERSERVER", 2)
    End Property
    Public Property Let FEATURE_MAXCONNECTIONSPERSERVER(ByVal Value)
      WriteFeature "FEATURE_MAXCONNECTIONSPERSERVER", Value
    End Property
    
    Public Property Get FEATURE_96DPI_PIXEL()
      FEATURE_96DPI_PIXEL = ReadFeature("FEATURE_96DPI_PIXEL", 1)
    End Property
    Public Property Let FEATURE_96DPI_PIXEL(ByVal Value)
      WriteFeature "FEATURE_96DPI_PIXEL", Value
    End Property
    
    Public Sub WritePageSetup(PageSetupKey As String, ByVal Value, Optional ValueType As String = "REG_SZ")
    ' sets e.g. "header" to a new string (attention: these are general settings for all IE-instances (their Print-Jobs)
    ' possible values for PageSetupKey are:
    ' "header", "footer", "margin_top","margin_left","margin_right""margin_bottom", "Shrink_To_Fit","Print_Background"
      Sh.RegWrite FeaturePageSetup & PageSetupKey, Value, ValueType
    End Sub
    
    Public Function ReadPageSetup(PageSetupKey As String, Optional ByVal Default)
      On Error Resume Next
        ReadPageSetup = Sh.RegRead(FeaturePageSetup & PageSetupKey)
        If Err Then
          ReadPageSetup = Default
          If Not IsEmpty(Default) Then WritePageSetup PageSetupKey, Default
        End If
      On Error GoTo 0
    End Function
    '----------------------- End of IE-Features-Interface --------------------------
    A minimum init-example for the above Class (called at App-startup, before loading any Browser-Controls)
    would look this way:
    Code:
         With New cIEFeatures 'ensures, that the most recent pre-installed IE-engine is used
            .FEATURE_BROWSER_EMULATION = Int(Val(.InstalledVersion))
         End With
    You can of course make use of Intellisense in the With- block,
    and explicitely derivate from all the other defaults which I've ensured in Class_Initialize,
    but please make your first attempt in the way it was shown above.

    HTH

    Olaf
    Last edited by Schmidt; Mar 15th, 2020 at 09:12 PM.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    May 2016
    Location
    China
    Posts
    197

    Re: VB6 does not use IE core browser

    Hi Schmidt thank you very much for your help.
    The test can display normally (post compile test, do not test in IDE).
    QQ: 289778005

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width