Page 9 of 14 FirstFirst ... 6789101112 ... LastLast
Results 321 to 360 of 555

Thread: VB6 WebView2-Binding (Edge-Chromium)

  1. #321

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    The "scrambling" has already happened in this case
    (meaning that the passed param uXML already contains "mangled" string-data).

    Please check, where (and how) this uXML-param was retrieved (and then passed) -
    and whether the proper decoding took place whilst filling it elsewhere.

    It might also be, that the xml-header-string (as shown below, for UTF8-mode) -
    points to a code-page, entirely different from UTF8... XML allows that...
    (in which case, you shouldn't write it out as UTF8 via New_c.FSO.WriteTextContent).

    The example code below shows, that when uXML is filled with proper Unicode,
    the WebView2 can show Unicode-XML (in this case with a few german Umlauts), just fine.

    Code:
    Private WithEvents WV As cWebView2
    
    Private Sub Form_Load()
      Visible = True
    
      Set WV = New_c.WebView2(hWnd)
     
      Dim uXml$: uXml = "<?xml version='1.0' encoding='UTF-8'?>" & vbCrLf & _
                        "<root><foo>" & ChrW(228) & ChrW(246) & ChrW(252) & _
                        "</foo><bar>" & ChrW(223) & ChrW(8364) & ChrW(248) & "</bar></root>"
                   
      Const FileName = "c:\temp\simple.xml"
      
      New_c.FSO.WriteTextContent FileName, uXml, True
      WV.Navigate FileName
    End Sub
    HTH

    Olaf

  2. #322
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    ----
    Last edited by tmighty2; Apr 20th, 2023 at 03:21 AM.

  3. #323
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    How could I deserialize "Result"?

    This does not compile and throws an Argument Byref Invalid error:

    Code:
    Set Elements = New_c.JSONDecodeToCollection(Result)
    Code:
    Private Sub WV_JSAsyncResult(Result As Variant, ByVal Token As Currency, ByVal ErrString As String)
    
        Debug.Print ErrString
        
        If Not Token = m_Token Then
            Exit Sub
        End If
        
        If IsEmpty(Result) Then
           Exit Sub
        End If
        
    'retrieve a few elements "by selector-expression"
        Dim Elements As cCollection
      Set Elements = New_c.JSONDecodeToCollection(Result)
    This is my JS code:

    Code:
    async function getActiveLinks() {
    	let linksArray  = [];
    
    	let linksSource = Array.from(document.querySelectorAll("a, area, button, select, textarea, object, input:not([type=\"hidden\"]), [role=link], [role=button], [role=combobox], [role=option], [role=textbox], [role=checkbox], [role=menuitem]"));
    
    	for (let i = 0; i < linksSource.length; i++) {
    		if (await isElelementVisible(linksSource[i], true, true)) {
    			let text = await getTextValue(linksSource[i]);
    			if (text.length > 0) {
    				linksArray.push({
    					text : text,
    					vsnID: linksSource[i]._vsnEsureId()
    				});
    			}
    		}
    	}
    
    		try {
                                              let thestring=JSON.stringify(linksArray);
                                              alert(thestring);
    			return thestring;
    		} catch (e) {
    			alert(e);
    		}
    
    }
    And if I try this...

    Dim s$
    s = Result

    VB6 tells me error 447: "Object does not support the current language setting"

    Name:  länd2.jpg
Views: 2194
Size:  24.1 KB
    Last edited by tmighty2; Apr 20th, 2023 at 04:25 AM.

  4. #324

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by tmighty2 View Post
    How could I deserialize "Result"?

    This does not compile and throws an Argument Byref Invalid error:

    Code:
    Set Elements = New_c.JSONDecodeToCollection(Result)
    Please try explicit conversion of the Variant Result to a String:
    Set Elements = New_c.JSONDecodeToCollection(CStr(Result))

    The VB6-compiler is a bit picky in this case, because both -
    Result is a "ByRef" Param and JSONDecodeToCol(...) also expects a ByRef As String argument)

    In other words, VB6 would not have any complaints about passing -
    e.g. a Variant-Return-Result of a VB-Function (like e.g. WV.jsRun()) into the JSONDecode-Byref argument directly.

    Here is an example, which works (showing async Result-Handling)
    Code:
    Option Explicit
    
    Private WithEvents WV As cWebView2, Elements As cCollection, AsyncTokens As cCollection
     
    Private Sub Form_Load()
      Visible = True
      Set WV = New_c.WebView2(hWnd)
      
      With New_c.StringBuilder 'js-helpers
          .AddNL "function getElements(sExpr){"
          .AddNL "    var resArr = []"
          .AddNL "    for (var e of document.querySelectorAll(sExpr).values()){"
          .AddNL "        resArr.push({tag:e.tagName, id:e.id, val:e.value, name:e.name, href:e.href})"
          .AddNL "    }"
          .AddNL "    return JSON.stringify(resArr)"
          .AddNL "}"
          
          .AddNL "function setElementBackgroundById(id, color){"
          .AddNL "    document.querySelector('#'+id).style.background = color"
          .AddNL "}"
          
          WV.AddScriptToExecuteOnDocumentCreated .ToString
      End With
      
      With New_c.StringBuilder 'two anchors and two buttons as test-HTML-content
        .AddNL "<a id='a1' href='#foo'>LinkFoo</a><br>"
        .AddNL "<input id='b1' type='button' value='button 1'><br>"
        .AddNL "<a id='a2' href='#bar'>LinkBar</a><br>"
        .AddNL "<input id='b2' type='button' value='button 2'><br>"
        
        WV.NavigateToString .ToString
      End With
      
      Set AsyncTokens = New_c.Collection(False)
      'retrieve a few elements asynchronously "by selector-expression"
      AsyncTokens.Add "getElements", WV.jsRunAsync("getElements", "a, input")
    End Sub
     
    Private Sub WV_JSAsyncResult(Result As Variant, ByVal Token As Currency, ByVal ErrString As String)
      If Not AsyncTokens.Exists(Token) Then Exit Sub
    
      Dim JobType As String: JobType = AsyncTokens(Token): AsyncTokens.Remove Token
      Select Case LCase$(JobType)
        Case "getelements"
          Set Elements = New_c.JSONDecodeToCollection(CStr(Result))
          
          Dim Elmt As cCollection 'the enumerated Elements themselves are (again) of type cCollection - but hold a JSON-Object instead of a JSON-array
          For Each Elmt In Elements 'iteration over the gathered Element-Objects in the JSON-Array: Elements
             Debug.Print Elmt.SerializeToJSONString 'just to show, which properties are contained "per element"
    
             Select Case UCase$(Elmt("tag")) 'first Property-access on an Element (here the "tag"-Property)
               Case "A":     WV.jsRun "setElementBackgroundById", Elmt("id"), "#f00"
               Case "INPUT": WV.jsRun "setElementBackgroundById", Elmt("id"), "#0f0"
             End Select
          Next
      End Select
    End Sub
    The other error you'getting is probably related, to not returning a String (but a COM-wrapped js-Object).
    Please ensure, that you also return a String in case of an Error... (from your js-Functions - e.g. via return e.message in the catch-branch).
    It is then relatively easy, to check whether the first char of such a String is either "{" or "[" == a JSON-String ... otherwise an error-string.

    Olaf

  5. #325
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: VB6 WebView2-Binding (Edge-Chromium)

    how to get text from xpath:

    Code:
    Function GetXpathText(Xpath As String) As String
        Dim js As String
        js = "document.evaluate(""" & Xpath & """, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText"
        GetXpathText = Web1.jsProp(js)
    End Function
    Code:
     Dim js As String
        js = "document.evaluate(""" & Xpath & """, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText"
     js = "alert(" & js & ")"
    
     
    Web1.ExecuteScript js
    alert is ok,but jsProp err,why?


    Code:
    Function GetXpathText(Xpath As String) As String
        Dim js As String
        js = "var XPathText=document.evaluate(""" & Xpath & """, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText"
        Web1.ExecuteScript js
    doevents
        GetXpathText = Web1.jsProp("XPathText")
    End Function
    
    'Web1.jsProp("XPathText.innerText")
    Function GetTextByXpath(Xpath As String, Optional Method As String = ".innerText") As String
        Dim js As String
        js = "var XPathText=document.evaluate(""" & Xpath & """, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue"
        Web1.ExecuteScript js
    doevents
        GetTextByXpath = Web1.jsProp("XPathText" & Method)
    End Function
    Is there a built-in method or more efficient technology that can run this?
    Last edited by xiaoyao; Apr 20th, 2023 at 11:35 AM.

  6. #326
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Using my old browser, I defined a callback object (a COM dll) and a sub which would be called by the JS.

    Can you tell me how I would do that with your browser? This is mycode:

    Code:
    async function exportChatAsXMLHelper(params){
    	let displayname 	= params[0];
    	let includeMedia 	= params[1];
    	let debug 			= params[2];
    	
    	let xml = await exportChatAsXML(displayname, includeMedia, debug);
    
    	//where is JSCallbackReceiver defined? it is from vb6
    	window.JSCallbackReceiver.OnWhatsAppXMLReceived(xml);
    }
    
    async function exportChatAsXML(displayname, includeMedia, debug){
    	//displayname, includeMedia, debug
    
        let chat = (await WPP.chat.list()).find(m => m.contact && m.contact.name && m.contact.name.includes(displayname));
        await WPP.chat.openChatBottom(chat.id);
        let msgs = await WPP.chat.getMessages(chat.id, {count : -1});
    
        const log = (obj) => debug && console.log(obj);
    
        log('Total messages: ' + msgs.length);
    
        let xml = '';
    
        xml+= '<messages>';
    
        for (var i = 0; i < msgs.length; i++) {
            log('Message number: ' + i);
    
            let message = msgs[i];
            xml+= '<message>';
            xml+= '<sender>'+ message.from.user +'</sender>';
            xml+= '<receiver>'+ message.to.user +'</receiver>';
    
            xml+= '<type>'+ (message.type || '') +'</type>';
    
            if(message.type == 'chat'){
                xml+= '<body>'+ message.body +'</body>';
            }
    
            if(message.type != 'chat' && includeMedia) {
                xml+= '<media>';
                xml+= '<caption>'+ (message.caption || '') +'</caption>';
                xml+= '<filename>'+ (message.filename || '') +'</filename>';
    
                log('Downloading media');
    
                try{
                    let mediabody = await mediatoBase64(message.id);
                    xml+= '<MediaDownloadStatus>success</MediaDownloadStatus>';
                    xml+= '<base64>'+ mediabody +'</base64>';
                }
                catch(e){
                    xml+= '<base64></base64>';
                    xml+= '<MediaDownloadStatus>fail</MediaDownloadStatus>';
                }
                xml+= '</media>';
            }
    
            xml+= '</message>';
        }
    
        xml+= '</messages>';
    
        return xml;
    }
    
    
    //-----
    async function mediatoBase64(msgid) {
        let blob = await WPP.chat.downloadMedia(msgid);
        return new Promise((resolve, _) => {
            const reader = new FileReader();
            reader.onloadend = () => resolve(reader.result);
            reader.readAsDataURL(blob);
        });
    }

  7. #327

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by tmighty2 View Post
    Using my old browser, I defined a callback object (a COM dll) and a sub which would be called by the JS.
    WV.AddObject is your friend...

    Olaf

  8. #328
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Olaf, I love your work!
    Thank you so much!!

  9. #329
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Could you tell me how I would call this from VB6?

    Code:
    async function exportChatAsXMLHelper(params){
    	let displayname 	= params[0];
    	let includeMedia 	= params[1];
    	let debug 			= params[2];
    //alert(displayname);
    	await exportChatAsXML(displayname, includeMedia, debug);
    }
    async function exportChatAsXML(displayname, includeMedia, debug)
    {
        let chat = null;
        if(displayname != ''){
            chat = (await WPP.chat.list()).find(m => m.contact && m.contact.name && m.contact.name.includes(displayname));
        } else {
            chat = (await WPP.chat.list()).find(m => m.active);
        }
        await WPP.chat.openChatBottom(chat.id);
        let msgs = await WPP.chat.getMessages(chat.id, {count : -1});
    
        const log = (obj) => debug && console.log(obj);
    
        //alert(msgs.length);
    
        log('Total messages: ' + msgs.length);
    
        let count=msgs.length;
    
        for (var i = 0; i < count; i++) {
            log('Message number: ' + i);
    
            let message = msgs[i];
            let xml='';
            xml+= '<message>';
            xml+= '<sender>'+ message.from.user +'</sender>';
            xml+= '<receiver>'+ message.to.user +'</receiver>';
    
            xml+= '<type>'+ (message.type || '') +'</type>';
    
            if(message.type == 'chat')
            {
                xml+= '<body>'+ message.body +'</body>';
            }
    
            if(message.type != 'chat' && includeMedia)
            {
                xml+= '<media>';
                xml+= '<caption>'+ (message.caption || '') +'</caption>';
                xml+= '<filename>'+ (message.filename || '') +'</filename>';
    
                log('Downloading media');
    
                try
                {
                    let mediabody = await mediatoBase64(message.id);
                    xml+= '<MediaDownloadStatus>success</MediaDownloadStatus>';
                    xml+= '<base64>'+ mediabody +'</base64>';
                }
                catch(e)
                {
                    xml+= '<base64></base64>';
                    xml+= '<MediaDownloadStatus>fail</MediaDownloadStatus>';
                }
                xml+= '</media>';
            }
    
            if (i>50)
            {
                 //alert('exit!');
               // break;
            }
    
            xml+= '</message>';
    
            //where is JSCallbackReceiver defined? it is from vb6
           TheApp.OnWhatsAppXMLReceived(xml,i, count);
           xml='';
        }
      //  xml+= '</messages>';
      //  return xml;
    }
    I have tried this, but it threw an "Object not defined" error:

    Code:
    WV.CallByName Array(sChatName, True, False), "exportChatAsXMLHelper", VbSet
    
    Public Sub OnWhatsAppXMLReceived(ByVal xml As String, ByVal index As Long, ByVal max As Long)
    
    End Sub

  10. #330

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by tmighty2 View Post
    I have tried this, but it threw an "Object not defined" error:

    Code:
    WV.CallByName Array(sChatName, True, False), "exportChatAsXMLHelper", VbSet
    
    Public Sub OnWhatsAppXMLReceived(ByVal xml As String, ByVal index As Long, ByVal max As Long)
    
    End Sub
    Not sure, why you're using WV.CallByName, when it was already established,
    that js-functions shall be called via either:
    - WV.jsRun( "someJsFunction", ..., ... ) or
    - WV.jsRunAsync "someOtherFunc", ..., ...

    Also cannot deduce the purpose of your intermediate function (exportChatAsXMLHelper) -
    you can call the main-routine perfectly fine (with its 3 arguments) via e.g. WV.jsAsync...

    Here is an example again:
    Code:
    Option Explicit
    
    Private WithEvents WV As cWebView2, Elements As cCollection
     
    Private Sub Form_Load()
      Visible = True
      Set WV = New_c.WebView2(hWnd)
          WV.AddObject "TheApp", Me
          
      With New_c.StringBuilder
          .AddNL "async function exportChatAsXML(displayname, includeMedia, debug){"
          .AddNL "    TheApp.ReportIncomingArguments(displayname, includeMedia, debug)"
          .AddNL "}"
    
          WV.AddScriptToExecuteOnDocumentCreated .ToString
      End With
      WV.NavigateToString "Dummy-Document-Content"
      
      WV.jsRunAsync "exportChatAsXML", "TheDisplayName", True, False
    End Sub
     
    Public Sub ReportIncomingArguments(sDisplayname, bIncludeMedia, bDebug)
      Debug.Print sDisplayname, bIncludeMedia, bDebug
    End Sub
    Olaf

  11. #331
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    The error that I'm getting is not really related to the browser, I guess, but I wanted to ask anyway.

    https://drive.google.com/file/d/1WwW...ew?usp=sharing

    I am injecting the script using AddScriptToExecuteOnDocumentCreated.

    I have successfully done this:

    Public Sub ReportIncomingArguments(sDisplayname, bIncludeMedia, bDebug)
    Debug.Print sDisplayname, bIncludeMedia, bDebug
    End Sub

    However, when I try to use my WhatsApp function, I get an error saying

    VM11:2 Module Conn was not found with e=>e.Conn&&e.ConnImpl
    get @ VM11:2
    VM11:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'on')
    at E.<anonymous> (<anonymous>:2:164253)
    at E.emitAsync (<anonymous>:2:53133)
    at <anonymous>:2:239794
    at a (runtime.276e78425ec3861add7e.js:1:15161)
    at Array.forEach (<anonymous>)
    at runtime.276e78425ec3861add7e.js:1:15333
    at runtime.276e78425ec3861add7e.js:1:15393
    at runtime.276e78425ec3861add7e.js:1:15397

    What could I check to find out where it goes wrong?

    The JS file was done by somebody else. I don't know where the webpack code came from.
    But I know that I successfully used the JS in my old browser.

    If anybody can suggest what to try to pinpoint the problem, I would be glad.
    Thank you!

  12. #332

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by tmighty2 View Post
    The error that I'm getting is not really related to the browser, I guess, but I wanted to ask anyway.

    https://drive.google.com/file/d/1WwW...ew?usp=sharing

    ...
    However, when I try to use my WhatsApp function, I get an error saying

    VM11:2 Module Conn was not found with e=>e.Conn&&e.ConnImpl
    Looks like:
    - another js-dependency (or js-module) is still missing (not pre-loaded)...
    - or your larger js-block runs "too early" (try loading it in WV_DocumentComplete with WV.ExecuteScript instead)
    - or the script-code needs to be run from within a script tag with attribute type='module': https://stackoverflow.com/questions/...-module-syntax

    Best advice I can give at this point, is to get yourself help from a js-Expert...

    Olaf

  13. #333
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    I did that, and it turned out that the webpack code was either outdated or malformed in some way.
    Olaf, your components help me to pay my living since 20 years :-)

  14. #334
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    If I have added code using "AddScriptToExecuteOnDocumentCreated", how would I clear that again?

    I have not checked, but I am afraid that some parts of the JS may be double as I add several JS files.
    And some websites do not need all of these scripts.

    That is why I wonder if I should do housekeeping and keep everything clean.

  15. #335

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by tmighty2 View Post
    If I have added code using "AddScriptToExecuteOnDocumentCreated", how would I clear that again?

    I have not checked, but I am afraid that some parts of the JS may be double as I add several JS files.
    And some websites do not need all of these scripts.

    That is why I wonder if I should do housekeeping and keep everything clean.
    As already mentioned in my last post - an alternative way to add script-modules,
    is to do it in the DocumentComplete-Event... via WV.ExecuteScript your-module-source-code.

    Within that event you can react conditionally what to load, depending on the current Document-URL.

    AddScriptToExecuteOnDocumentCreated is useful for:
    - truly generic, never-changing helper-functions - which work and are useful on any site
    - or to cover very specific "local" or "single-site" scenarios
    ...(using the current WV-instance which was placed on a specific Form).

    Also keep in mind that, when you e.g. write your own UserControl -
    you can have different WV-instances (each of them bound to the internal UserControl.hWnd)...
    Such a control could have its own Public URL-Property Let and Get ...
    and multiple instances of such a UC could be arranged for e.g. "tabbed Browsing".
    You could decide, what dependencies you will load - by looking at the incoming NewURL-Param in the URL-Prop-Let-routine.

    Olaf

  16. #336
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Olaf, are you aware of that RemoteMessenger.postSyncRequestMessage error popping up in the DevToolsWindow each time?

  17. #337

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by tmighty2 View Post
    Olaf, are you aware of that RemoteMessenger.postSyncRequestMessage error popping up in the DevToolsWindow each time?
    Yes, it will be fixed in the next release.

    Olaf

  18. #338
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: VB6 WebView2-Binding (Edge-Chromium)

    ......
    Last edited by xiaoyao; Jun 12th, 2023 at 08:40 PM.

  19. #339

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xiaoyao View Post
    Please explain yourself properly (instead of posting dubious links to some "betting-websites").

    Olaf

  20. #340
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Would it have any bad impact if I have 2 instances of the browser?
    I am not sure if there is a way to make something like tabs.
    I would like to quickly switch from etc. google.com to youtube.com.
    I manipulate the DOM and execute scripts on these websites. I am currently stuck because my google.com scripts and youtube.com scripts interfere. I guess I can make that work, but I would anyways like to ask if it woul be good practice to keep these 2 apart by using 2 browser instances.

  21. #341
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: VB6 WebView2-Binding (Edge-Chromium)

    It is best to create two processes, otherwise if two web pages run in one thread, the speed will become slower

  22. #342

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xiaoyao View Post
    It is best to create two processes, otherwise if two web pages run in one thread, the speed will become slower
    The chromium-engine (which MS-Edge-WebView2 is using under the covers) -
    is already working "multi-process-based" underneath - a short view into the Taskmanager would show you that...

    So, the hWnd a Client-Process (the VB6-App) will bind a WV-instance to,
    is only the "tip of the iceberg" (a ViewPort-rectangle) - these multiple chromium-processes finally "Blit-to" -
    (and in the opposite direction, will only receive KeyBoard- and Mouse-Messages from)...

    So, no - there is no performance-penalty (and also no memory-problem) with multiple WV-instances in a given VB-App.

    Besides, could you please post only about topics you're really knowledgeable about?
    (and if you do, then in "better understandable english").

    Currently you come across as a "spamming lunatic", resembling a "badly implemented chat-bot".

    Olaf

  23. #343
    Addicted Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    134

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post

    Currently you come across as a "spamming lunatic", resembling a "badly implemented chat-bot".

    Olaf
    that is perfectly correct!
    you had to dare to say it! Thanks Olaf for making it !


  24. #344
    New Member
    Join Date
    Dec 2022
    Posts
    9

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hi Olaf,
    you have the method "OpenDevToolsWindow", could you please also add "CloseDevToolsWindow" to the API?

  25. #345

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Bob17 View Post
    Hi Olaf,
    you have the method "OpenDevToolsWindow", could you please also add "CloseDevToolsWindow" to the API?
    AFAIK, there's currently no built-in method in the official typelib for that...

    So you have to go via "normal API" (e.g. using FindWindow - the Window seems always to start with the Caption-prefix "DevTools").

    HTH

    Olaf

  26. #346
    Junior Member
    Join Date
    Feb 2020
    Posts
    18

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hi Olaf,
    How to use the "SetFuncObj" method?

    Thanks!

  27. #347

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by paliadoyo View Post
    How to use the "SetFuncObj" method?
    It's a method, meant for "RC6-internal-use" (to establish easier communication with the js_side of the WV2 in the initialization-phase) -
    and I had to make it a Public-Method instead of Friend, for OLE-marshaling to work...)

    Once a WV is initialized, the "official UserApi" to place COM-instances in the js-context (e.g for callback-purposes), is:
    WV.AddObject ..., ...

    Olaf

  28. #348
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Is there any way to block this error from occuring until the new version has been released? It is pretty distracting in the dev console window.

  29. #349
    Junior Member
    Join Date
    Feb 2020
    Posts
    18

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    It's a method, meant for "RC6-internal-use" (to establish easier communication with the js_side of the WV2 in the initialization-phase) -
    and I had to make it a Public-Method instead of Friend, for OLE-marshaling to work...)

    Once a WV is initialized, the "official UserApi" to place COM-instances in the js-context (e.g for callback-purposes), is:
    WV.AddObject ..., ...

    Olaf
    Perfect. Thanks!

  30. #350
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Under some circumstances, "WV.DocumentURL" might take around 3 seconds.

    If I get it in WV_DocumentComplete like this...

    Code:
    Private Sub WV_DocumentComplete()
           
        g_sCurrentURL = WV.DocumentURL
        g_sCurrentTitle = WV.DocumentTitle
    ... it is always fast.
    However, when I call it at other times, it might take up to 3 seconds. That is why I store it in WV_DocumentComplete.

    Thanks!

  31. #351
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    I can execute JS on "https://google.de" or "https://google.com.tr" just fine.
    On "https://google.com", it does not work.
    Is anybody familiar with this?
    I will post a sample project shortly.

  32. #352
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    I can execute JS on "https://google.de" or "https://google.com.tr" just fine.
    On "https://google.com", it does not work.
    Is anybody familiar with this?

    Here is a sample project: https://drive.google.com/file/d/1aYj...ew?usp=sharing
    And here is a video: https://www.youtube.com/watch?v=Snz8JN6zGw4

  33. #353
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Code:
    window.addEventListener ? (document.addEventListener("DOMContentLoaded", c, !1), window.addEventListener("load", c, !1)) : window.attachEvent && window.attachEvent("onload", c);
    in https://google.com

    This broke webview2 host object and other webview2 functions

    Code:
    	(function () {
    		var b       = [function () {
    			google.tick && google.tick("load", "dcl");
    		}];
    		google.dclc = function (a) {
    			b.length ? b.push(a) : a();
    		};
    
    		function c() {
    			for (var a = b.shift(); a;) a(), a = b.shift();
    		}
    
    		//window.addEventListener ? (document.addEventListener("DOMContentLoaded", c, !1), window.addEventListener("load", c, !1)) : window.attachEvent && window.attachEvent("onload", c);
    	}).call(this);

  34. #354
    Fanatic Member
    Join Date
    Jul 2017
    Posts
    761

    Re: VB6 WebView2-Binding (Edge-Chromium)

    This morning I woke up wondering if Olaf Schmidt has a Wikipedia entry.

  35. #355
    New Member
    Join Date
    Nov 2020
    Posts
    7

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Found cause to following issue, no reply needed.

    Hi

    I am running into issue with Windows Server 2016 which can't even run the WebView2Demo which results in the following error on launch:

    Run-time error '430':

    Class does not support Automation or does not support expected interface.


    The same version of RC6 controls/dll's on my Windows 10/11 workstations work fine but not on 2016.

    Have reinstalled MS Webview2 components and also installed MS Edge Browser to but that didn't help.

    Any ideas on what I am missing?

    Thanks

    Carl
    Last edited by carl039; May 12th, 2023 at 12:33 PM.

  36. #356

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by carl039 View Post
    Found cause to following issue, no reply needed.

    ...I am running into issue with Windows Server 2016 which can't even run the WebView2Demo which results in the following error on launch:
    Just out of interest, was it a missing "registration" of the RC6.dll on that server-machine?
    (or something else)?

    Olaf

  37. #357
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by carl039 View Post
    Found cause to following issue, no reply needed.

    Hi

    I am running into issue with Windows Server 2016 which can't even run the WebView2Demo which results in the following error on launch:

    Run-time error '430':

    Class does not support Automation or does not support expected interface.


    The same version of RC6 controls/dll's on my Windows 10/11 workstations work fine but not on 2016.

    Have reinstalled MS Webview2 components and also installed MS Edge Browser to but that didn't help.

    Any ideas on what I am missing?

    Thanks

    Carl
    Official: Microsoft Edge WebView2 profile - Microsoft Edge Development | Microsoft Learn
    https://learn.microsoft.com/zh-cn/mi...edge/webview2/
    WebView2 runtime version 109 is the final version that supports the following versions of Windows. The WebView2 runtime and SDK version 110.0.1519.0 and later do not support these operating systems.

    Windows 8/8.1
    Windows 7
    Windows Server 2012 R2
    Windows Server 2012
    Windows Server 2008 R2

  38. #358
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: VB6 WebView2-Binding (Edge-Chromium)

    I heard that there is a way to read and write MYSQL database without installing the driver, just extract a DLL like SQLITE3.DLL?
    Maybe a special ADOx86.DLL,ado x64.dll? Can I read and write to the database without installation?
    This way, different operating systems will have the same experience and won't cause all kinds of compatibility issues and errors.
    EDGE, for example, has a version 109 that supports older Windows 7, Windows 8, and so on. But he can't have a single DLL for all operating systems.
    MINIBLINK.DLL does this (a DLL is only 17m-35M, it's like installing IE11, an old version of Google Chrome, some of which is not supported, but works perfectly with electron,node js), but the latest version is only blink 75. Now Google is in version 113

  39. #359
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: VB6 WebView2-Binding (Edge-Chromium)

    i want to show webview by vb.net with rc6.dll

    In the SHARPDEVELOP developer tool, the reference to RC6.DLL does not show the class
    Unable to load type library referencing "RC6". The library is not registered. (Exception from HRESULT:0x8002801D (TYPE_E_LIBNOTREGISTERED)) (MSB3287)
    Is your RC6.DLL developed in VC++2010? It took me a lot of time to install the WINDOWS 8.0SDK before I could compile it

    HOW TO USE IN VB.NET?LIKE THIS

    Next you need to register the DLL. Select the Start menu's Run command and execute the statement:

    regsvr32 VB6Project.dll
    Next start a Visual Basic .NET project. Select the Project menu's Add Reference command. Click the COM tab and find the DLL or click the Browse button to select it. Now the .NET application can use the DLL's public classes as shown in the following code.

    Code:
    Private Sub btnCallSubroutine_Click(ByVal sender As _
        System.Object, ByVal e As System.EventArgs) Handles _
        btnCallSubroutine.Click
        Dim vb6_class As New VB6Project.MyVB6Class
        vb6_class.VB6SayHi()
    End Sub
    
    Private Sub btnCallFunction_Click(ByVal sender As _
        System.Object, ByVal e As System.EventArgs) Handles _
        btnCallFunction.Click
        Dim vb6_class As New VB6Project.MyVB6Class
        MessageBox.Show("Returned: " & vb6_class.VB6ReturnHi())
    End Sub
    Last edited by xiaoyao; May 19th, 2023 at 03:46 AM.

  40. #360
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Those last two posts do not appear to be related in any way to the topic at hand. The topic does seem to have wandered a bit, so the second one is kind of on topic, but not the post about SQLLite.
    My usual boring signature: Nothing

Page 9 of 14 FirstFirst ... 6789101112 ... LastLast

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