VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors-VBForums
Results 1 to 16 of 16

Thread: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,107

    VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Just a small Demo, how one can work these days with the IE-Control on a VB6-Form.

    There's three main-topics which this Demo addresses:
    - how to elevate the IE-Version from its default (which for compatibility-reasons always mimicks the age-old version 7)
    - how to load the IE-Control dynamically, after the elevation above went through
    - how to connect Elements on a page comfortably to normal VB6-EventHandlers

    But also addressed is stuff like:
    - how to load ones own HTML-template-code from a string into the Control
    - how to enable the "themed look" of the Browser-Controls (avoiding the old "sunken edge 3D-style")
    - how to work with the HTML5-canvas (in a "cairo-like-fashion") to produce antialiased output

    The Event-approach as shown in the Demo does not require any References
    or COMponent-check-ins, or Typelibs - the whole thing is based on a plain, virginal VB6-Project
    which does not have any dependencies (and thus should work without installation anywhere when compiled).

    Here's what is produced:


    And here the Source-Code for the Demo:
    http://vbRichClient.com/Downloads/WebEvents.zip

    Olaf

  2. #2
    Hyperactive Member
    Join Date
    Sep 2012
    Posts
    404

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Wonderful. I tested on Win10 and XP, it was successful. Though canvas is invalid on XP, it does not matter.

    I have a few questions would like to ask:

    Is this a new way of VB6 development?

    Does this mean that we can achieve the following goals?
    (1) We can use HTML as new UI elements for VB6 applications, that is to replace all the COM components with HTML?
    (2) We can use JavaScript and HTML5 chart control in VB6?
    (3) We can make full use of the various conveniences brought by JavaScript and HTML5, especially HTML5?
    (4) Your New IDE FormDesigner will use XML (or HTML) as the UI storage format?

    In other words, we can achieve all the features of asp/asp.net web applications in vb6?

    Thanks very much, Olaf. You brought us too many good things
    Last edited by dreammanor; May 23rd, 2017 at 05:13 AM.

  3. #3
    Addicted Member
    Join Date
    Aug 2016
    Posts
    153

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    can use HTML as new UI elements for VB6 applications.answer is ok.other i dnot know

  4. #4
    Hyperactive Member
    Join Date
    Sep 2012
    Posts
    404

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Quote Originally Posted by xxdoc123 View Post
    can use HTML as new UI elements for VB6 applications.answer is ok.other i dnot know
    xxdoc123, thank you for your reply. I have also seen a few simple examples of using HTML as VB6 UI elements. I would like to know: if I use HTML instead of all the COM components, just like a real web application, is this feasible?

  5. #5
    PowerPoster
    Join Date
    Oct 2013
    Posts
    2,847

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Can you please keep your questions in your own threads??
    You are polluting a lot of threads (even codebank submissions) with all kind of the same questions...

  6. #6
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,504

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    These are old techniques that seem to have been lost. it's nice to see them consolidated in a Codebank post.

    FYI, if you have control over the html, you can add a
    Code:
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    and it will render properly without having to "elevate" the browser control.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,107

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Quote Originally Posted by DEXWERX View Post
    FYI, if you have control over the html, you can add a
    Code:
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    and it will render properly without having to "elevate" the browser control.
    Nope, the Registry-writes from cIEFeatures are definitely needed as it seems,
    because when I comment them out - and instead put the Header you suggested in
    (which is the Meta-tag I'm using in all my "normal WebPages" as well, when they run in full Browser-Hosts),
    I see this:



    No Canvas there - and also the Theming was lost - but also when I comment the Theming-Meta back in,
    then the Theming is back, but the Canvas is still not there...

    Here's the code-corrections I was using in the posted Demo-Code (in Form_Load):
    Code:
    Private Sub Form_Load()
    '  With New cIEFeatures
    '    .FEATURE_BROWSER_EMULATION = Int(Val(.InstalledVersion)) 'elevate the Browser-Version from its default-version 7
    '  End With
     
      Set wbExt = Controls.Add("Shell.Explorer.2", "wb") 'only after the above went through, are we allowed to create a BrowserControl
          wbExt.Visible = True
          
      Set wb = wbExt.object
          wb.navigate2 "about:blank"
      Do: DoEvents: Loop Until wb.readyState = 4 '<- READYSTATE_COMPLETE
     
      wb.Document.write "<!DOCTYPE HTML><html><head>"
    '  wb.Document.write "<meta http-equiv=""msThemeCompatible"" content=""yes"">"
      wb.Document.write "<meta http-equiv=""X-UA-Compatible"" content=""IE=edge"">"
      wb.Document.write "<meta charset=""UTF-8""></head>" 
     '...
    Maybe you were running into the "already elevated in the registry"-trap (since it works, based on the Exe-Name) -
    so to test that properly you should compile into a new Exe-name (after you commented the ciEFeature-lines out).

    Olaf

  8. #8
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,504

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    interesting, seems the meta tag only elevates the render mode to IE8... (no canvas)
    (That tells you the last time I checked on this)

    document.documentMode will tell you IE's render mode.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE

  9. #9
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,504

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Odd, this project doesn't seem to be "elevating" the browser on Win7 / IE11.
    The Registry is properly modified - and the same EXE works well on Win10.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,107

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Quote Originally Posted by DEXWERX View Post
    Odd, this project doesn't seem to be "elevating" the browser on Win7 / IE11.
    The Registry is properly modified - and the same EXE works well on Win10.
    Thanks for testing...
    I for my part can confirm "proper behaviour" on two VMs:
    - Win8 (which has a "max IE-version" of 10 - there never was an IE11-update for Win8)
    - and Win 8.1 (which was "auto-updated" from IE10 to IE11 here)

    Win7 might be different, in that - MS provided a "sidewards-upgrade-package" for IE11 on Win7 (other than on Win8).

    What happens, when you (e.g. manually) switch the registry-entry to 9000 instead of the (autodetected) 11000?
    Or maybe Win7 is more sensitive with the "ExeName-Root-Entry" (demandig "all-lower-case" or "all-upper-case"-letters)?

    Would be nice, when you could find a solution on what needs to be present in the Registry,
    so that the Canvas finally shows up on the system in question.

    Olaf

  11. #11
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,504

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Quote Originally Posted by Schmidt View Post
    Thanks for testing...

    Win7 might be different, in that - MS provided a "sidewards-upgrade-package" for IE11 on Win7 (other than on Win8).

    What happens, when you (e.g. manually) switch the registry-entry to 9000 instead of the (autodetected) 11000?
    Or maybe Win7 is more sensitive with the "ExeName-Root-Entry" (demandig "all-lower-case" or "all-upper-case"-letters)?

    Would be nice, when you could find a solution on what needs to be present in the Registry,
    so that the Canvas finally shows up on the system in question.

    Olaf
    Definitely something odd about how IE11 was rolled out on my corporate Win7 machine.
    I'm invested, so I will report back if I find a solution.

    setting the entry to 9000 also has no effect. It may be something specific to this corporate environment, we have some sort of compatibility override for intranet applications. "Enterprise Mode"
    Last edited by DEXWERX; Jun 6th, 2017 at 07:39 AM.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    17,531

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    None of this is called "elevation" it is "feature emulation."

    Nothing like teaching each other how to "talk wrong" I guess. Language is power, don't squander it.

  13. #13
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,504

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    figured it out - turns out the registry settings aren't being redirected to Wow6432Node...

    Quote Originally Posted by dilettante View Post
    None of this is called "elevation" it is "feature emulation."

    Nothing like teaching each other how to "talk wrong" I guess. Language is power, don't squander it.
    I believe we've already corrected Olaf's creative use of language in multiple other threads, but it's good not to mislead everyone else reading the thread.

    You gotta know the rules to break the rules, or in this case we just "sound" like idiots. I enjoy these life lessons from the wise old sage that is dilettante.
    Last edited by DEXWERX; Jun 6th, 2017 at 08:39 AM.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,107

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    Quote Originally Posted by dilettante View Post
    None of this is called "elevation" it is "feature emulation."
    Nope, not really.
    If at all, it is "feature-enabling" (after the Class with the speaking name cIEFeatures was properly initialized).

    This proper initialization of the IEControl (to the version which is installed on the system),
    is what I call (in the context of this thread) "elevation" (from the otherwise "emulated" version 7, up to its "true, uncrippled capabilities").

    Quote Originally Posted by dilettante View Post
    Nothing like teaching each other how to "talk wrong" I guess. Language is power, don't squander it.
    If there's someone in this forum I'd use as a role-model for their "written command of the english language",
    it'd be Tanner or JPBro - certainly not you (sorry).

    Olaf

  15. #15
    New Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    2

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    I did not know such a simple and effective way to "capture" IE events via vb6 pure - even here in the forum, there are many interesting tips on how to use IE Control, but not that way. The solution was simple, perfect ...

    Olaf, without you the VB6 would not be the same these days.

    I do not know if programmers have the real notion of the grandiosity of the projects you do. The vbRichClient is unbelievable ... You know how difficult it is to find a great solution Sqlite with VB6, Olaf made available and still with the encryption feature (your data saved safely).

    Thank you and many others here from the forum .. and also could not fail to specifically mention the great importance of LaVolpe.

    ---
    Thiago

  16. #16
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,504

    Re: VB6 elevated IE-Control-usage with HTML5-elements and COM-Event-connectors

    FYI turns out I was wrong about the registry redirection. the real issue stems from enterprise mode.
    It only seems to work if the HKLM key is used, and completely ignores the HKCU...

    talk about strict. seems an interesting way to lock down apps without an installer / or admin rights.
    enterprise mode basically breaks portable apps that use a webbrowser control...
    Last edited by DEXWERX; Aug 29th, 2017 at 04:31 PM.
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.