Page 1 of 2 12 LastLast
Results 1 to 40 of 54

Thread: Help needed on RC6, Webview2

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Help needed on RC6, Webview2

    I have a webpage that loads locally and i am migrating to RC6 webview2 to display my page.

    I have a Link that is clickable, but when i click it , i dont want the page to load in the RC6 webview.

    i want to capture that i clicked it but then stop the process. I then wall to Shell out to a browser

    Code:
    Private Sub WV_JSMessage(ByVal sMsg As String, ByVal sMsgContent As String, oJSONContent As cCollection)
      Debug.Print sMsg, sMsgContent
      Select Case sMsg
        Case "btn1_click": MsgBox "txt1.value: " & WV.jsProp("document.getElementById('txt1').value")
        
        Case "click"
        If sMsgContent = "Website" Then
          Dim ret As Long                                    'To Accept Return Value
                ret = ShellExecute(Me.hWnd, "Open", URL, "", App.Path, 1) 
    
      ' << here i want to stop the page being displayed in the webview
        End If
        
      End Select
    
    
    End Sub
    if Olaf is looking please advise.

    re the website link, this is a url to a webpage, how do i get the link to the URL variable.?
    I hover over the link and i can see the url flash up at the bottom , but cannot figure out how to pass the link to url

    tks
    Last edited by k_zeon; Feb 22nd, 2023 at 05:25 PM.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    anyone. How can i surpress loading a webpage on clicking a link so i can shell out to a browser. tks

    edit: just found this. Looks like what i need. will try once i get home.

    Code:
    Private Sub WV_NewWindowRequested(ByVal IsUserInitiated As Long, IsHandled As Long, ByVal URI As String, NewWindowFeatures As RC6.cCollection)
      Debug.Print "URI: "; URI
      
      Dim i As Long 'Print out, what's sitting behind the NewWindowFeatures JSON-Collection
      For i = 0 To NewWindowFeatures.Count - 1
        Debug.Print NewWindowFeatures.KeyByIndex(i), NewWindowFeatures.ItemByIndex(i)
      Next
      
      IsHandled = 1 'prevent the WebView from "doing its own thing" about the new window
    End Sub
    Last edited by k_zeon; Feb 23rd, 2023 at 08:36 AM.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    So just tested the above for new window and it does not work when i click a link on the main page.

    How can i click a link and then stop webview doing its thing.

    I want to process the click event which i have, but dont want the webview to load the new page.

    can someone help as i cannot move forward unit this is sorted.

    tks for any help.

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: Help needed on RC6, Webview2

    You might have to wait till Olaf is around. This question is very specific. It is about WebView and about RC6 which may narrow the amount of members that might be able to help with this.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Niya View Post
    You might have to wait till Olaf is around. This question is very specific. It is about WebView and about RC6 which may narrow the amount of members that might be able to help with this.
    ok, tks. I just could not find a way to stop a page loading after clicking a link.
    i just want to control what happens after i click the link.

    will wait paitently

  6. #6
    PowerPoster
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    2,412

    Re: Help needed on RC6, Webview2

    Post a minimal project sample for us non-Olaf entities to play around with. I would be happy to give it a look (and I might even find an answer before Olaf wanders by), but I don't have time to create one myself right now.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by jpbro View Post
    Post a minimal project sample for us non-Olaf entities to play around with. I would be happy to give it a look (and I might even find an answer before Olaf wanders by), but I don't have time to create one myself right now.
    tks jpbro..
    if you download Olaf's demo
    https://www.vbforums.com/showthread....t=webview2demo

    and then load a page from a site or local file that has clickable links.

    So what i am trying to do is once a link is clicked , the new page is not loaded.

    at present i have the below code in the demo WV_JSMessage event and want to open the link in an external browser
    and not the webview. I would like the webview to keep the original page and not load the page link.

    is there a way like in the WV_NewWindowRequested event ( see code 2 below) that can be used some how. ie IsHandled = 1 'prevent the WebView from "doing its own thing" about the new window

    Code:
    Private Sub WV_JSMessage(ByVal sMsg As String, ByVal sMsgContent As String, oJSONContent As cCollection)
      Debug.Print sMsg, sMsgContent
      Select Case sMsg
      
     
        Case "click"
        If sMsgContent = "Website" Then
    
          Dim ret As Long                                    'To Accept Return Value
          ret = ShellExecute(Me.hWnd, "Open", URL, "", App.Path, 1) 
    
    
    
        End If
        
      End Select
    
    
    End Sub

    Code:
    Private Sub WV_NewWindowRequested(ByVal IsUserInitiated As Boolean, IsHandled As Boolean, ByVal URI As String, NewWindowFeatures As RC6.cCollection)
    
      Debug.Print "URI: "; URI
      
      IsHandled = 1 'prevent the WebView from "doing its own thing" about the new window
    
    End Sub

  8. #8
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Well what happens when you set bHandled = True?

    I believe you also have to cancel the navigation, according to a brief search on this topic.

    Of course the difference between how to do it with actual WebView2 APIs and RC6 wrappers being an excellent reason why you need at least one of source or documentation.

    I'm putting WebView2 into oleexp/tbShellLib; so people can use the actual interfaces

    It's in tbShellLib now for the twinBASIC users out there, oleexp will be a few days as I'm still sorting through translations for the Speech APIs I'm also adding next version.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    Well what happens when you set bHandled = True?

    I believe you also have to cancel the navigation, according to a brief search on this topic.

    Of course the difference between how to do it with actual WebView2 APIs and RC6 wrappers being an excellent reason why you need at least one of source or documentation.

    I'm putting WebView2 into oleexp/tbShellLib; so people can use the actual interfaces

    It's in tbShellLib now for the twinBASIC users out there, oleexp will be a few days as I'm still sorting through translations for the Speech APIs I'm also adding next version.
    Hi fafalone. where is bHandled declared.?

    There is no StartNavigation event that has a cancel

    re: I believe you also have to cancel the navigation , this is what i am trying to find with no luck

    re WV_NewWindowRequested, if i rightclick a link and open in new window and set IsHandled = 1 then it stops a new page opening.

    but nothing i can find will stop the existing page from loading a new page when clicking a link.

    if you do get WebView2 in oleexp would you be able to create a demo like the Webview2Demo

    tks.

    still hoping that what i have now there will be someone who can give me an answer. tks

  10. #10
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Sorry I meant IsHandled.

    Does RC6 not have a wrapper for ICoreWebView2NavigationStartingEventHandler? That has a Cancel argument.
    Last edited by fafalone; Feb 24th, 2023 at 02:04 PM.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    Sorry I meant IsHandled.

    Does RC6 not have a wrapper for ICoreWebView2NavigationStartingEventHandler? That has a Cancel argument.
    i have only just started using RC6 + webview and just used the demo that is on line. and i dont see any cancel argument

    I just use the demo at https://www.vbforums.com/showthread....t=webview2demo
    and this have a few events etc with the codes above.

    unless there is something that i am missing.?

    Name:  image1.jpg
Views: 588
Size:  17.9 KB

  12. #12
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Doesn't look like it has a wrapper for nav started. Might be out of luck until Olaf adds it. The twinBASIC WebView2 package doesn't implement it either, but since that's open source it could be modified easier, if you didn't want to implement the whole thing from scratch.

    I am planning to write a demo for the interfaces but realistically it will be a few weeks as I want to finish some other things first.

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    Doesn't look like it has a wrapper for nav started. Might be out of luck until Olaf adds it. The twinBASIC WebView2 package doesn't implement it either, but since that's open source it could be modified easier, if you didn't want to implement the whole thing from scratch.

    I am planning to write a demo for the interfaces but realistically it will be a few weeks as I want to finish some other things first.
    ok, tks. I am in the middle of a major recode for one of my apps and will take some time anyway.
    look forward to you example when ready.

    Olaf, if you read this, can you advise if/when you may add the cancel navigation. tks

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by k_zeon View Post
    Olaf, if you read this, can you advise if/when you may add the cancel navigation.
    Have just added the NavigationStarting-Event (including a Cancel-Param) to new version 6.0.13
    (which I will upload at the start of the next week)...

    In the interim, you might use a js-based solution, which can look as simple as that:
    (using the Browsers built-in "beforeUnload"-event, which pops-up a built-in Browser-Dialog)
    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
     
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
      WV.AddScriptToExecuteOnDocumentCreated "addEventListener('beforeunload',(e)=>{e.returnValue=''})"
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
    Or a bit more elaborate - expanding on the approach ...
    (now determining also the Dst-URL, and suppressing the built-in Dialog)
    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
    
    Public DstUri As String '<- define a Public Property (reachable from js-Code)
    
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
      WV.AddObject "Me", Me
      WV.AddScriptToExecuteOnDocumentCreated "addEventListener('beforeunload',(e)=>{Me.DstUri=document.activeElement.href; e.returnValue=''})"
      WV.AreDefaultScriptDialogsEnabled = False
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
     
    Private Sub WV_ScriptDialogOpening(ByVal ScriptDialogKind As RC6.eWebView2ScriptDialogKind, Accept As Boolean, ResultText As String, ByVal URI As String, ByVal Message As String, ByVal DefaultText As String)
      Debug.Print "Destination: "; DstUri
      If ScriptDialogKind = SCRIPT_DIALOG_KIND_BEFOREUNLOAD Then WV.ExecuteScript "stop()"
    End Sub
    Whereas with the new version (coming next week), you can solve it this way:
    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
     
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
     
    Private Sub WV_NavigationStarting(ByVal IsUserInitiated As Boolean, ByVal IsRedirected As Boolean, ByVal URI As String, Cancel As Boolean)
      Debug.Print "Destination: "; URI
      Cancel = InStr(1, URI, "google.com", 1) = 0 'suppress any navigation to sites different from "google.com"
    End Sub
    HTH

    Olaf

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    Have just added the NavigationStarting-Event (including a Cancel-Param) to new version 6.0.13
    (which I will upload at the start of the next week)...

    In the interim, you might use a js-based solution, which can look as simple as that:
    (using the Browsers built-in "beforeUnload"-event, which pops-up a built-in Browser-Dialog)
    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
     
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
      WV.AddScriptToExecuteOnDocumentCreated "addEventListener('beforeunload',(e)=>{e.returnValue=''})"
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
    Or a bit more elaborate - expanding on the approach ...
    (now determining also the Dst-URL, and suppressing the built-in Dialog)
    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
    
    Public DstUri As String '<- define a Public Property (reachable from js-Code)
    
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
      WV.AddObject "Me", Me
      WV.AddScriptToExecuteOnDocumentCreated "addEventListener('beforeunload',(e)=>{Me.DstUri=document.activeElement.href; e.returnValue=''})"
      WV.AreDefaultScriptDialogsEnabled = False
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
     
    Private Sub WV_ScriptDialogOpening(ByVal ScriptDialogKind As RC6.eWebView2ScriptDialogKind, Accept As Boolean, ResultText As String, ByVal URI As String, ByVal Message As String, ByVal DefaultText As String)
      Debug.Print "Destination: "; DstUri
      If ScriptDialogKind = SCRIPT_DIALOG_KIND_BEFOREUNLOAD Then WV.ExecuteScript "stop()"
    End Sub
    Whereas with the new version (coming next week), you can solve it this way:
    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
     
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
     
    Private Sub WV_NavigationStarting(ByVal IsUserInitiated As Boolean, ByVal IsRedirected As Boolean, ByVal URI As String, Cancel As Boolean)
      Debug.Print "Destination: "; URI
      Cancel = InStr(1, URI, "google.com", 1) = 0 'suppress any navigation to sites different from "google.com"
    End Sub
    HTH

    Olaf
    Wow, thats fantastic. i will wait for the new version as i still have a lot of other stuff to do. thank you so much.

    will i be able to use the below if i cancel the navigation when clicking a link to open a new web page or use the new WV_NavigationStarting and put the shellexecute in there. tks

    Code:
    Private Sub WV_JSMessage(ByVal sMsg As String, ByVal sMsgContent As String, oJSONContent As cCollection)
      Debug.Print sMsg, sMsgContent
      Select Case sMsg
      
     
        Case "click"
        If sMsgContent = "Website" Then
    
          Dim ret As Long                                    'To Accept Return Value
          ret = ShellExecute(Me.hWnd, "Open", URL, "", App.Path, 1) 
    
    
    
        End If
        
      End Select
    
    
    End Sub
    Last edited by k_zeon; Feb 25th, 2023 at 03:22 AM.

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    Of course the difference between how to do it with actual WebView2 APIs and RC6 wrappers
    being an excellent reason why you need at least one of source or documentation.
    So, now "poor me" is even supposed to document, what's not implemented in a wrapper-class.
    BTW, the term "wrapper" suggests, that the current implementation follows closely:
    "already existing interface-docmentation, provided elsewhere" (in this case the official MS-docu).

    What about showing some consistency, e.g. "heckling" Wayne in the same way...
    (Last I've looked, tb was closed-source, including the tb-WV2-wrapper)

    FYI - since there still seem to be doubts about my seriousness regarding opening RC6 -
    as soon as an open-source-VB6-compiler exists:

    In a dialog we've had - I've offered early on (shortly after tb was introduced, long before Wayne started the tb-IDE),
    to open up RC6 immediately, when he'd open-up the tb-compiler as well under a suitable FOSS-license).

    He declined.
    We'd be working on the Linux-version of tb-already (hosted in a platform-independent, VB6-coded-IDE) - if he hadn't.

    Olaf

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by k_zeon View Post
    ...will i be able to use the below if i cancel the navigation when clicking a link to open a new web page or use the new WV_NavigationStarting and put the shellexecute in there.
    There'd be no need to raise a "userdefined Event" from within js-Code,
    just use the WV_NavigationStarting-Event (then Cancel+ShellExecute, depending on the URI-content).

    Just tested this here... the following will open (from the google-searchresult-page we navigated to initially):
    - "*.microsoft.com"-Links via New_c.FSO.ShellExecute (after Cancelling the "internal Page-Flip")
    - all other Links will be navigated to by the WV-Control

    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
     
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
     
    Private Sub WV_NavigationStarting(ByVal IsUserInitiated As Boolean, ByVal IsRedirected As Boolean, ByVal URI As String, Cancel As Boolean)
      If InStr(1, URI, "microsoft.com", 1) Then
        Cancel = True: New_c.FSO.ShellExecute URI
      End If
    End Sub
    HTH

    Olaf

  18. #18
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    So, now "poor me" is even supposed to document, what's not implemented in a wrapper-class.
    BTW, the term "wrapper" suggests, that the current implementation follows closely:
    "already existing interface-docmentation, provided elsewhere" (in this case the official MS-docu).
    This is a strawman you've set up as you've conflated two entirely different comments of mine. The comment about documentation was in regards to the differences between the underlying WebView2 interfaces and RC6s implementation/wrapper of them. And for that, yes, I stand by the comment. You know full well the lack of documentation is a common complaint about RC5/6.

    What about showing some consistency, e.g. "heckling" Wayne in the same way...
    (Last I've looked, tb was closed-source, including the tb-WV2-wrapper)
    You obviously aren't following the tB GitHub and Discord if you think I haven't discussed open sourcing tB, and I, along with others, volunteered to help with the documentation Wayne is organizing. The tB WebView2 wrapper is open source. In fact I was just kicking myself because I forgot that and could have saved some time not re-porting half the interface definitions from scratch.

    Also, we've discussed a key difference here before: You aren't commercializing RC5/6. There's entirely different arguments for closed/open source for products you're trying to sell.

    FYI - since there still seem to be doubts about my seriousness regarding opening RC6 -
    as soon as an open-source-VB6-compiler exists:

    In a dialog we've had - I've offered early on (shortly after tb was introduced, long before Wayne started the tb-IDE),
    to open up RC6 immediately, when he'd open-up the tb-compiler as well under a suitable FOSS-license).

    He declined.
    We'd be working on the Linux-version of tb-already (hosted in a platform-independent, VB6-coded-IDE) - if he hadn't.

    Olaf
    Someone not open sourcing their commercial product is not a good argument for or against opening your non-commercial one.

    And while RC6 is certainly an impressive project and I have much respect for your talent as a programmer, I'm not disappointed that it's not powering tB.

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    Someone not open sourcing their commercial product
    is not a good argument for or against opening your non-commercial one.
    You sure have some "twisted logic" going on there...
    Entirely disregarding my ongoing commitment, to help the VB6-community for about 30years now -
    with free source-code far surpassing your contribution *and* free pre-compiled tools).

    But feel free to "pay me for my work", in case that'd ease "some tension" on your end.

    Olaf

  20. #20

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    There'd be no need to raise a "userdefined Event" from within js-Code,
    just use the WV_NavigationStarting-Event (then Cancel+ShellExecute, depending on the URI-content).

    Just tested this here... the following will open (from the google-searchresult-page we navigated to initially):
    - "*.microsoft.com"-Links via New_c.FSO.ShellExecute (after Cancelling the "internal Page-Flip")
    - all other Links will be navigated to by the WV-Control

    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
     
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
     
    Private Sub WV_NavigationStarting(ByVal IsUserInitiated As Boolean, ByVal IsRedirected As Boolean, ByVal URI As String, Cancel As Boolean)
      If InStr(1, URI, "microsoft.com", 1) Then
        Cancel = True: New_c.FSO.ShellExecute URI
      End If
    End Sub
    HTH

    Olaf
    tks Olaf. appreciate all your hard work and i bet lots of other people do as well.

    I know you have the Webviewdemo but would be great to have a repository of small apps that do certain things within the web view.
    i know VB coding but not really any JS coding. so would be helpful to see other peoples implementations of things that they do.
    Maybe a mod could create a new sub forum under Visual basic 6 and earlier like vbRichclient examples.

    what does everyone think.

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by k_zeon View Post
    Maybe a mod could create a new sub forum under Visual basic 6 and earlier like vbRichclient examples.
    There's no need for that IMO... (since we already have the CodeBank).

    Just start your own contribution there (as soon as you've finished a nice example) -
    and title the whole thing "VB6 WebView2/RC6-examples".

    Then everyone can add "other useful ones" into the appropriate Codebank-thread...
    (there's also a few smaller helpful snippets in the original CodeBank-thread already)

    Though "learning JavaScript" is a necessity IMO, when working with the WebView2,
    since it does not offer a "DOM-manipulation-COM-interface" like the old IE-Control.

    Sooner or later you will have to add your own little js-Functions into the WV2-context,
    to accomplish certain "more advanced" things "internally" (sending only the results of these functions to VB6).

    Olaf

  22. #22
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    You sure have some "twisted logic" going on there...
    Entirely disregarding my ongoing commitment, to help the VB6-community for about 30years now -
    with free source-code far surpassing your contribution *and* free pre-compiled tools).

    But feel free to "pay me for my work", in case that'd ease "some tension" on your end.

    Olaf
    It's twisted logic to say that basing your decision whether to open source on someone else's decision when it's motivated by something entirely else is unsound? That's total nonsense.

    And that was a nasty comment to make after I complimented your work and told you I respected you. My contributions are extensive, so why the need for a dick measuring contest where you think you've done more? If you were selling a product I was interested in I'd be happy to pay for it, just as I subscribe to tB (well probably not now that you're being a dick to me for no reason). But you're not. So you just have insults and excuses rather than good arguments.

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    It's twisted logic to say that basing your decision whether to open source on someone else's decision when it's motivated by something entirely else is unsound? That's total nonsense.
    ???
    I've mentioned my motives behind the delay of the open-sourcing of the RichClient
    already several times here in the forum - (long before tb became "a topic", ... you can search for it).

    It's because I'm interested to see a multiplatform-capable IDE and compiler, where both are "OpenSourced".
    Because only a completely open toolchain has a chance of success long-term IMO...
    (you don't find any popular, long-term survivable language anymore, which is not "fully opensourced").
    And yes, I'm still working a few hours per weekend on my own version of a VB-compiler.

    I've also mentioned several times already, that the amount of working-hours invested in the RC, sums up to about 5Man-Years.
    Expressed in working-hours, that's roughly 250*8*5=10000...
    Now please apply an hourly rate of your own choosing - and then tell me,
    that I'm not allowed to protect this investment, as long as "the main-vision I developed this for" (as stated above) is not met.

    The reason, why I mentioned my dialog with Wayne about that,
    was only to refute doubts about my seriousness (or honesty) about:
    "opening up RC6 at the time, when the complete toolchain is opensourced".

    Because, if he'd said "Ok, let's open-up everything" at that time... I'd have surely delivered -
    (and of course helped the tb-project on top of that for free, no matter in which way Wayne earned some extra-money with it).

    Why I don't help currently on the "tb-front" has to do with "the technical-base, the current efforts are founded upon",
    not "personal reasons" (no "bad blood" between us).
    It will become more clear to Wayne what I mean with that, as soon as he starts working on the Linux-version of compiler and IDE.

    Olaf
    Last edited by Schmidt; Feb 25th, 2023 at 11:27 PM.

  24. #24
    Hyperactive Member
    Join Date
    Jul 2017
    Posts
    344

    Re: Help needed on RC6, Webview2

    Is there the "FrameLoadStart" event?
    I need to injects JS at this event. I don't know if WebView2 has that event at all.
    CefSharp does have it.
    Last edited by tmighty2; Feb 26th, 2023 at 02:34 AM.

  25. #25
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    ???
    I've mentioned my motives behind the delay of the open-sourcing of the RichClient
    already several times here in the forum - (long before tb became "a topic", ... you can search for it).

    It's because I'm interested to see a multiplatform-capable IDE and compiler, where both are "OpenSourced".
    Because only a completely open toolchain has a chance of success long-term IMO...
    (you don't find any popular, long-term survivable language anymore, which is not "fully opensourced").
    And yes, I'm still working a few hours per weekend on my own version of a VB-compiler.

    I've also mentioned several times already, that the amount of working-hours invested in the RC, sums up to about 5Man-Years.
    Expressed in working-hours, that's roughly 250*8*5=10000...
    Now please apply an hourly rate of your own choosing - and then tell me,
    that I'm not allowed to protect this investment, as long as "the main-vision I developed this for" (as stated above) is not met.

    The reason, why I mentioned my dialog with Wayne about that,
    was only to refute doubts about my seriousness (or honesty) about:
    "opening up RC6 at the time, when the complete toolchain is opensourced".

    Because, if he'd said "Ok, let's open-up everything" at that time... I'd have surely delivered -
    (and of course helped the tb-project on top of that for free, no matter in which way Wayne earned some extra-money with it).

    Why I don't help currently on the "tb-front" has to do with "the technical-base, the current efforts are founded upon",
    not "personal reasons" (no "bad blood" between us).
    It will become more clear to Wayne what I mean with that, as soon as he starts working on the Linux-version of compiler and IDE.

    Olaf
    So you believe you're 'protecting your investment' because one of the tiny sliver of programmers with the ability to make something as large and complex as a fully VB6-compatible compiler that's also cross-platform is going to decide to make such a thing, something that is basically a full time job to get done in years rather than a decade+, as a FOSS project they'll derive only a little extra income from, not enough to replace a full time job, in anything resembling the near-term, because you'll open source RC6 so they can build large sections of their project around it? And that keeping RC6 closed until they deliver first so they go into such an arrangement blindly is making this more likely? Or at least that someone will be so thrilled with the prospects of an open RC6 if they're not building on it they'll take that project on?

    Well good luck with that.

    I'd think open sourcing it under a license restricting it to other open source projects would make that slightly more likely (though still probably not happening).

    I want a fully open source toolchain too but there's just no way I can see that whether or not RC6 is or would be open sourced is going to change that. At this point the best hope for that is that tB becomes successful enough open source models become viable for a living income for Wayne, as he's indicated he'd be open to something like that in the future. I'll continue to be consistent in expressing a desire for that, as I've certainly shared my concerns that the closed source nature could limit tB adoption, especially after what MS did with VB6, and that there are in fact models for a decent income on open source once it's widely used (in fact here's a thread on the tB GitHub with me doing exactly that last week, before you mistakenly accused me of being inconsistent about it: https://github.com/twinbasic/twinbasic/issues/1472).

  26. #26
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by tmighty2 View Post
    Is there the "FrameLoadStart" event?
    I need to injects JS at this event. I don't know if WebView2 has that event at all.
    CefSharp does have it.
    WebView2 has a ICoreWebView2FrameCreatedEventHandler interface, but I don't know if RC6 has a wrapper for it.

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by tmighty2 View Post
    Is there the "FrameLoadStart" event?
    I need to injects JS at this event. I don't know if WebView2 has that event at all.
    CefSharp does have it.
    WebView2 does have such an Event ...
    (though currently not exposed on the RC6-side, because there's no need for that IMO).

    I'd suggest to continue this in the CodeBank-thread, where I've answered you in more detail:
    (with regards to "why I think, there's no pressing need for exposing the frame-interface").
    https://www.vbforums.com/showthread....=1#post5596670

    Olaf

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    I want a fully open source toolchain too...
    Good, then at least in this regard we talk on the same wave-length.

    As for everything else you've brought up...

    For me it's a simple decision-tree (with "hard-nodes" which represent "hard truths") -
    and simple and clear consequences which follow automatically whilst "walking it"...

    You seem to forget that, "me also developing an integrated compiler+IDE" is part of that decision-tree,
    where RC6 Classes fit in "tightly and efficiently" - representing my "ideal path" through that tree (on a minimal codebase).
    With the result of a "Compiler+IDE+Widgetset":
    ---- which is completely open (foss-license wise)
    ---- and is based on VB6-code in its entirety
    ---- able to "(re)compile the whole tool-chain" from within the new IDE (aka self-hosting)...
    ---- on all platforms in the same way (making use of those foss-libs, the RC6 is already based on, here in "Windows-land")

    Walking that tree any other way, results in either "hard No's" -
    or "compromises on my end" (which I'd be willing to make only, when certain conditions are met).
    My offer to Wayne was "one such (non-ideal) compromise".

    You talk about "respecting me" - but seem to be unwilling to make any serious attempts:
    - to fully understand "me and my motives"
    - nor do you fully grasp, what "time-savings" the RC6 represents for anyone who's tackling a similar task
    ..(especially when it later comes to the "multiplatform-part" in the development-efforts)

    And what you perceive as "dick-length comparisons" is me trying to point out, that you argue
    from a position of "not fully understanding the whole picture" -
    currently! not (yet) having (enough) experience in:
    - compiler-construction
    - nor "Windowing/Widget-frameworks"
    - nor do you have deep Linux-experience
    - nor "foss-experience" (license- and management-wise)

    I've seen foss-projects "squabbled or forked into insignificance" often enough,
    due to the same psych-patterns we see in this very thread here ("hurt male pride" playing the biggest role).

    Olaf

  29. #29
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    2,235

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    And yes, I'm still working a few hours per weekend on my own version of a VB-compiler.
    Pleased to hear this, I had always assumed that the VBn future would be OBasic and now that thought is partly rekindled.

    OBasic as a product name looks good. Possibly a little too similar to something else? Would MS complain now? I doubt it.
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  30. #30
    Hyperactive Member
    Join Date
    Jul 2017
    Posts
    344

    Re: Help needed on RC6, Webview2

    You need to intercept it to inject scripts for handicapped users!

  31. #31
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,652

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    Good, then at least in this regard we talk on the same wave-length.

    As for everything else you've brought up...

    For me it's a simple decision-tree (with "hard-nodes" which represent "hard truths") -
    and simple and clear consequences which follow automatically whilst "walking it"...

    You seem to forget that, "me also developing an integrated compiler+IDE" is part of that decision-tree,
    where RC6 Classes fit in "tightly and efficiently" - representing my "ideal path" through that tree (on a minimal codebase).
    With the result of a "Compiler+IDE+Widgetset":
    ---- which is completely open (foss-license wise)
    ---- and is based on VB6-code in its entirety
    ---- able to "(re)compile the whole tool-chain" from within the new IDE (aka self-hosting)...
    ---- on all platforms in the same way (making use of those foss-libs, the RC6 is already based on, here in "Windows-land")

    Walking that tree any other way, results in either "hard No's" -
    or "compromises on my end" (which I'd be willing to make only, when certain conditions are met).
    My offer to Wayne was "one such (non-ideal) compromise".

    You talk about "respecting me" - but seem to be unwilling to make any serious attempts:
    - to fully understand "me and my motives"
    - nor do you fully grasp, what "time-savings" the RC6 represents for anyone who's tackling a similar task
    ..(especially when it later comes to the "multiplatform-part" in the development-efforts)

    And what you perceive as "dick-length comparisons" is me trying to point out, that you argue
    from a position of "not fully understanding the whole picture" -
    currently! not (yet) having (enough) experience in:
    - compiler-construction
    - nor "Windowing/Widget-frameworks"
    - nor do you have deep Linux-experience
    - nor "foss-experience" (license- and management-wise)

    I've seen foss-projects "squabbled or forked into insignificance" often enough,
    due to the same psych-patterns we see in this very thread here ("hurt male pride" playing the biggest role).

    Olaf
    Your post still hasn't even attempted to offer an explanation for why you believe a closed, rather than open, RC6 is raising the probability of a 3rd party going into the commitment of a massive project and delivering it only to then merge it with yours, codebase-unseen. I may not know how to write a full-featured compiler, but I know the scale of such a project-- it's massive, and I think we're on the same page on that. Same goes for large frameworks; you're incorrect in your claim I don't grasp how much time someone could save if only they were build their work on RC6. But that's hardly the point... I sincerely doubt Wayne is making the mistake of thinking a cross platform framework is some minor effort either. So we're not even disputing technical points here, just questions of behavior and how people work, and it doesn't take special technical expertise to question how sound this plan is. If you were able to offer a pursuasive argument I'd certainly try to understand it, but you haven't. You've simply asserted as fact you believe RC6 being leveraged as a reward for developing the rest of the toolchain as a minimal income open source project is a realistic proposition. It's not, regardless of whether it would save 10 minutes or 10 years of development time.

    If you think it's my pride who's been hurt here, I would instead submit you're lashing out because I don't believe RC6 is just so important that it's source is key to being the impetus for someone to devote years of their life making little money developing an open source toolchain. While I certainly agree I'm not an expert in the technical skills you've listed, it's just a laugh when you imply I'm not a major contributor to the community, having also devoted thousands and thousands of hours to open source projects many have found useful... to hurt someone's pride, it has to ring true on some level, and I'm not the one who started slinging insults.

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

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by fafalone View Post
    Your post still hasn't even attempted to offer an explanation for why you believe a closed, rather than open, RC6 is raising the probability of a 3rd party going into the commitment of a massive project and delivering it only to then merge it with yours, codebase-unseen.
    I neither believe that, nor have I said that...
    (and BTW, your sentences are "weirdly long" and extremely difficult to read or make sense of).

    Quote Originally Posted by fafalone View Post
    You've simply asserted as fact you believe RC6 being leveraged as a reward for developing the rest of the toolchain as a minimal income open source project is a realistic proposition.
    I did not say that either.

    Again - if "somebody else but me" comes up with a decent opensource-multiplatform-VB6-compiler first, I'll open up the RC6 as well -
    (after building a multiplatform-IDE around it).
    Because then the "conditions for longterm-survival of a visual language" are met.

    And I don't care whether the person (or company):
    - is making any money with it... (due to some clever dual-licensing), or not
    - or whether the whole undertaking was "unprofitable" for them up to this point, or not

    There was a slight chance, that Wayne would have accepted (to save both of us time) -
    he didn't - and I'm entirely fine with that - end of story (and back to my own work).

    Quote Originally Posted by fafalone View Post
    I would instead submit you're lashing out because I don't believe RC6 is just so important that it's source is key to being the impetus for someone to devote years of their life making little money developing an open source toolchain.
    I'm not "lashing out", when I point out your "insufficient qualifications" -
    (regarding "judgement, how much value the RC6 represents" - in the given context of multiplatform-compiler+IDE-development).

    It certainly does have value in this regard (since it'd save at least 2 or 3 Man-Years of work).

    Olaf

  33. #33

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2011
    Posts
    498

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by Schmidt View Post
    Have just added the NavigationStarting-Event (including a Cancel-Param) to new version 6.0.13
    (which I will upload at the start of the next week)...


    Whereas with the new version (coming next week), you can solve it this way:
    Code:
    Option Explicit
     
    Private WithEvents WV As cWebView2
     
    Private Sub Form_Load()
      Me.Visible = True 'ensure Visibility before the Bind-call
      
      Set WV = New_c.WebView2(Me.hWnd)
     
      WV.Navigate "https://google.com/search?q=webview2"
    End Sub
     
    Private Sub Form_Resize()
      If Not WV Is Nothing Then WV.SyncSizeToHostWindow
    End Sub
     
    Private Sub WV_NavigationStarting(ByVal IsUserInitiated As Boolean, ByVal IsRedirected As Boolean, ByVal URI As String, Cancel As Boolean)
      Debug.Print "Destination: "; URI
      Cancel = InStr(1, URI, "google.com", 1) = 0 'suppress any navigation to sites different from "google.com"
    End Sub
    HTH

    Olaf
    Hi Olaf. just wondering when you will be releasing a new RC6 version that includes the StartNavigation cancel. tks

  34. #34
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: Help needed on RC6, Webview2

    Is rc6.dll ready to develop an IDe? I don't know what else is planned.

  35. #35
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by yereverluvinuncleber View Post
    Pleased to hear this, I had always assumed that the VBn future would be OBasic and now that thought is partly rekindled.

    OBasic as a product name looks good. Possibly a little too similar to something else? Would MS complain now? I doubt it.
    Olaf seems to do things differently than Wayne.

    Wayne is steadily advancing his project, and we can see his progress almost every day, he releases many versions and constantly improves and refines based on user feedback and testing. Wayne uses a standard business software development model.

    Olaf wouldn't reveal the details of his project or the status of the project, and then suddenly one day, his work was released, and it was a fully usable product with few bugs. It's really amazing and full of surprises. So, even though we have twinBasic now, I'm still looking forward to Olaf's Next-Basic, and I'm convinced that Olaf's work and Wayne's work are completely different things, and both products are worth having.

  36. #36
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: Help needed on RC6, Webview2

    Who has a free website hosting space that can facilitate everyone to upload images and then reference them to the forum page? The forum only has about 10M of image space, which has long been used up

  37. #37
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by SearchingDataOnly View Post
    I'm convinced that Olaf's work and Wayne's work are completely different things, and both products are worth having.
    Don't hold your breath for Olaf Basic honestly. It might happen but TB recent advances are pretty discouraging for any "rival product" like RAD Basic and the rest but who knows, Olaf might in fact get motivated by such "competition" :-))

    cheers,
    </wqw>

  38. #38
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by wqweto View Post
    Don't hold your breath for Olaf Basic honestly. It might happen but TB recent advances are pretty discouraging for any "rival product" like RAD Basic and the rest but who knows, Olaf might in fact get motivated by such "competition" :-))

    cheers,
    </wqw>
    I've seen twinBasic make tremendous progress, and I'm very happy for Wayne and very happy for our vb6 community. However, don't you realize that twinBasic still has a long, long way to go to develop into a mature language, even at the current pace, it will take 3-5 years. You should know the characteristics of a mature language. In this sense, both twinBasic and Olaf's Basic are far, far away.

    Also, I can't imagine what kind of business model twinBasic should adopt to survive. If twinBasic had been born 15 years earlier, twinBasic might have been able to adopt the business model it currently intends to adopt (closed source and survive by selling licenses), but for now, it is clearly unlikely to succeed. We all hope that Wayne could make more money with twinBasic, so that twinBasic will have better development prospects. But unless Wayne gets big venture capital and assembles his own development team, the opportunity to make big money won't come up.

    8 years ago, Olaf also had ambitious plans to develop a new Basic compiler full-time, and we all know he has the ability. Suddenly, however, he was hired by a large company, and he was left with weekends writing code for the compiler for a few hours. Who can guarantee that this won't happen to Wayne? Jabaco seems to be the same.

    I'm sorry I poured cold water on the excitement, but I'm really worried about twinBasic's business model.

  39. #39
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by SearchingDataOnly View Post
    I'm sorry I poured cold water on the excitement, but I'm really worried about twinBasic's business model.
    You don't know TB's business model, only Wayne has some ideas and it sure is going to evolve after imminent v1 release where more business opportunities are going to appear.

    Acqui-hiring the Intellectual Property or even whole Wayne's company by an established business is very possible which might doom our cherished successor or turn it to some Java-like language, who knows.

    Besides there are numerous open source community/company sponsored dev frameworks and languages that are not making billions but are still a viable option.

    cheers,
    </wqw>

  40. #40
    Frenzied Member VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    1,324

    Re: Help needed on RC6, Webview2

    Quote Originally Posted by wqweto View Post
    Don't hold your breath for Olaf Basic honestly. It might happen but TB recent advances are pretty discouraging for any "rival product" like RAD Basic and the rest but who knows, Olaf might in fact get motivated by such "competition" :-))
    It would make much more sense if they worked together on the same project rather than trying to make two separate products.

Page 1 of 2 12 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