Results 1 to 26 of 26

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

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,611

    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
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    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
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    531

    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
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    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 Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    4,699

    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
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    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.

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,611

    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
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    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.

  9. #9
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    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.

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,611

    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
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    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.

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    22,836

    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
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    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.

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,611

    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
    Junior Member
    Join Date
    Feb 2013
    Location
    Brasil
    Posts
    20

    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
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    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.

  17. #17
    Junior Member
    Join Date
    Dec 2016
    Posts
    20

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

    Quote Originally Posted by DEXWERX View Post
    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...
    i thought for a long time the same - but if you use the correct "process" name (case sensitive) then HKCU works as well.
    (even within the vb6 IDE)

    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
    "myprocess.exe"=dword:11000

  18. #18
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

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

    Thanks for the info Gusto about process case sensitivity.

    But they key I'm referring to is: Security_HKLM_only. It forces all IE settings to be read from HKLM only.

    Feel free to post an example that you think will work - I'll happily test it out on a protected machine.


    https://support.microsoft.com/en-us/...advanced-users
    Last edited by DEXWERX; Jun 15th, 2018 at 06:56 AM.

  19. #19

  20. #20
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

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

    Quote Originally Posted by wqweto View Post
    "to be read from *HKLM* only" probably?

    cheers,
    </wqw>
    exactly! fixed!

  21. #21
    New Member
    Join Date
    Oct 2019
    Posts
    2

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

    Hi there. First, Olaf, thanks for this incredible useful example. I've got a question. Let's say I have some textboxes, comboboxes or a datagrid etc. on my VB form as well as in the webbowser control. How would I sync data between those? Any tips or links? thank you in advance.

  22. #22

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    5,611

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

    Quote Originally Posted by byomi1 View Post
    Hi there. First, Olaf, thanks for this incredible useful example. I've got a question. Let's say I have some textboxes, comboboxes or a datagrid etc. on my VB form as well as in the webbowser control. How would I sync data between those? Any tips or links? thank you in advance.
    Without some sample-project in an uploaded *.zip of yours, it's hard to imagine what you're trying to accomplish...

    Olaf

  23. #23
    Frenzied Member
    Join Date
    Dec 2014
    Posts
    1,489

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

    what about unity webgl content?
    here: https://docs.unity3d.com/560/Documen...atibility.html
    it says its compatible, not fully, but at least to start it in internet explorer 11
    it seems to be firefox that has the most support, following by chrome, while ie11+ and edge have limited support.

    so, is there any "feature" that can unlock "some" unity webgl support?

    another thing, MP3
    I know HTML5 audio is not supported below IE9. but if we emulate it to 11, it should work.
    but I have problems with mp3, if I run it on windows 7 but not on windows 10,
    in windows 7 it should be IE11, at least reading the IE version build.
    so, is there anything I need to do to allow sounds in windows 7 using html5?

    I read somewhere IE11 has problem with mp3, and specifically in windows 7.
    someone suggested: The problem is that IE11 makes you enable the setting "Play Sounds in Webpage"
    a solution:
    Open Internet Explorer, click the Tools button,
    Click Internet Options. Tap or click the Advanced tab
    Under Multimedia, select Play sounds in webpage.
    Click Apply, OK. Now check if you can play the mp3 files.

    is it possible to try this programmatically?

    another link about this issue: https://answers.microsoft.com/en-us/...6-df41785821e2

    so, it seems to be a window 7 html5 mp3 problem.

    edit:
    more testing, some MP3 works, but not everything, checking the format/codec used, I cant see anything odd or different between a working mp3 and a non-working mp3.
    also, its always the same, so its not random, the mp3 that works, always works.
    of course trying this in windows 10, all mp3 works. this only happens in windows 7.

    edit:
    after more testing, the IE10 component in windows 7, seems to get stuck if the "http server" is sending a *.mp3 too fast. the html5 can have multiple files, pictures, data, sounds etc, but only mp3 have this problem.
    its like IE10 need some time to initialize the mp3 before allowing anything else to get downloaded. even so, IE10 is requesting the files, without giving care of this "initialization"
    by making the http server wait 1/4 of a second using (sleep 250) after each mp3 sent, it will not get stuck. maybe the time need to be increased if the computer is slow? not sure, but so far it works for me.
    Last edited by baka; Aug 5th, 2020 at 11:31 AM.

  24. #24
    Lively Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    80

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

    Quote Originally Posted by Schmidt View Post
    Just a small Demo, how one can work these days with the IE-Control on a VB6-Form.
    ... .. .
    ..
    .
    And here the Source-Code for the Demo:
    http://vbRichClient.com/Downloads/WebEvents.zip

    Olaf
    Excellent! Wonderful wonderful wonderful, Olaf. Thanks a TON.

    Kind regards.

  25. #25
    Lively Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    80

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

    Quote Originally Posted by DEXWERX View Post
    ... .. .
    It only seems to work if the HKLM key is used, and completely ignores the HKCU...
    ... .. .
    enterprise mode basically breaks portable apps that use a webbrowser control...
    I am sorry. Kindly bear with me for not being able to exactly understand what you have conclusively written here.

    You mean to say that Olaf's WebEvents demo 'does not and will not' work (both in the IDE and executable form) in scenarios like yours? Kindly clarify.
    If so, is there any solution for this? I mean, are there any changes to be made in the values of the registry entries in Olaf's code? For instance, should the value of the string constant 'FeatureBaseKey' in Olaf's "cIEFeaturespoint" class point to a different registry key (from HKLM)?

    Kind Regards.

  26. #26
    Lively Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    80

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

    Quote Originally Posted by Schmidt View Post
    Just a small Demo, how one can work these days with the IE-Control on a VB6-Form. ... .. .

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

    Olaf
    Dear Olaf,

    I noticed the following observation from DEXWERX in post no. 16 (https://www.vbforums.com/showthread....=1#post5208133)
    Originally Posted by DEXWERX
    ... .. .
    It only seems to work if the HKLM key is used, and completely ignores the HKCU...
    ... .. .
    enterprise mode basically breaks portable apps that use a webbrowser control...
    With reference to the above observation, I wish to know the following:
    1. Does this mean that in case of 'enterprise mode' systems, my apps using the methodology given by you in WeEvents.zip demo may not work?

    2. If so, what is the work-around? Should the registry entries be added in a similar HKLM key instead? I did read this page where "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" is mentioned as one of the alternate keys that can be used.

    3. If registry entries should be added in HKLM key only (in 'enterprise' mode systems), how to check whether system is in enterprise mode? And, how to add the entries correctly? Just changing 'HKCU' to 'HKLM' in the two "Const" variables at the top of your cIEFeatures.cls would suffice I believe. Am I right?

    4. If "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION" itself can be safely used (to add the required registry entries), why not have that itself as the destination key to be changed rather than the one in HKCU? Because, with HKLM being used as the base key, the 'enterprise mode' system cases will get automatically covered, as well as all other cases. Is it not?

    Your utmost help and clear-cut guidance on the above will be much appreciated. Because, before going ahead using your methodology (in WebEvents.zip), I wish to be "fully" clear on the above things.

    Kind regards.
    Last edited by softv; Sep 10th, 2021 at 12:26 PM.

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