Page 3 of 12 FirstFirst 123456 ... LastLast
Results 81 to 120 of 480

Thread: VB6 WebView2-Binding (Edge-Chromium)

  1. #81
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: VB6 WebView2-Binding (Edge-Chromium)

    vb6 webdriver,support vba,call edge chrome,
    msedgedriver.exe


    Without systematic teaching materials, many people will only use simple open web pages.

    I've tested this before, getting all the tabs, switching between any of them, and it's very time consuming to debug.

    So if you can have a master sub-installed easier to use, many people will not need to learn to use.

    JS, database, network programming, interface beautification, Google browser control, these areas have great market potential in the future.

    https://blog.csdn.net/qq_24499417/ar...ails/105602339

    https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
    Last edited by xiaoyao; Sep 4th, 2021 at 02:26 PM.

  2. #82
    PowerPoster
    Join Date
    Jan 2020
    Posts
    3,746

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Microsoft WIN11 preinstalled messaging APP teams 2.0 experience: Built on Edge Webview 2 2021-08-18

    Just saw the news, the future win11 comes with a webview2 runtime.
    There is no need to download and install it manually in the future, so it is much more convenient.

    If we study webdriver more thoroughly, what browser is automatically detected on the client? Automatically download the driver, automatically open the web page and automatically fill in the form.

    Applications such as Microsoft Office have begun to deploy WebView2 Runtime in their applications. WebView 2 Runtime has been installed on more than 200 million Windows devices.
    Last edited by xiaoyao; Sep 4th, 2021 at 02:50 PM.

  3. #83
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hello Olaf
    Is it possible to add the management of the new DownloadStarting event of webview2 in RC6 ?.
    This would allow to change the default download directory.

    Thanks a lot

    François

    Here is the link to Microsoft Documentation of this new event
    WebView2 Win32 C++ ICoreWebView2_4 | Microsoft Docs

  4. #84
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    234

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    Have just finished a Binding to the new WebView2-BrowserControl (based on Edge-Chromium).
    ... .. .
    ... .. .
    The new BaseDll-package of the RC6 now includes the official WebView2Loader.dll (version 1.0.674),
    which the cWebView2-class then works against.
    ... .. .
    ... .. .
    You should now be able to test this new Edge-Browser-Binding (even on Win7-OSes) via this little VB6-Demo:
    ... .. .
    Please let me know, when something is not working as expected -
    or when you want me to include a certain extra-functionality into the new cWebView2-class.

    I want to "finalize" the new RC6-functionality at the end of the year (then switching Binary-Compatibility on).

    Happy testing...

    Olaf

    Dear Olaf,

    First thing first. Thanks a TONNN, as ever. It was great seeing your demo in action! Wow!

    Actually, fortunate that I stumbled on this forum page (when I was really desperate to find a demo on how to use WebView2 in your RC6). How I wish all these demos of yours (or) links to these kinds of forum pages were in your vbRichClient.com website in one page! Anyway, I fully understand your lack of time.

    Well, you have asked us to let you know if something is not working. I am just giving hereunder what happened when I ran the demo:

    1. For the following procedures, VB6 reported "Compile error: Procedure declaration does not match description of event or procedure having the same name"
    Code:
    Private Sub WV_AcceleratorKeyPressed(ByVal KeyState As eWebView2AccKeyState, ByVal IsExtendedKey As Long, ByVal WasKeyDown As Long, ByVal IsKeyReleased As Long, ByVal IsMenuKeyDown As Long, ByVal RepeatCount As Long, ByVal ScanCode As Long, IsHandled As Long)  
      Debug.Print "WV_AcceleratorKeyPressed"
    End Sub
    Code:
    Private Sub WV_NavigationCompleted(ByVal IsSuccess As Long, ByVal WebErrorStatus As Long)
      Debug.Print "WV_NavigationCompleted"
    End Sub
    2. Instead of immediately researching on what the abovementioned error could be due to, I just commented out both the above procedures and ran the demo. And, there it was! Your demo in super action! Thanks, Olaf! People like you give lots of joy to persons like me!

    Well, why did the compile error pop up for the abovementioned two procedures? Have they to be redeclared with different number/types of parameters? If so, kindly let me know how. In case the Compile error was due to some other reason, then kindly educate me on the same too.

    Kind Regards.
    Last edited by softv; Sep 11th, 2021 at 12:15 PM.

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

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by softv View Post
    Well, why did the compile error pop up for the abovementioned two procedures? Have they to be redeclared with different number/types of parameters? If so, kindly let me know how. In case the Compile error was due to some other reason, then kindly educate me on the same too.
    See https://www.vbforums.com/showthread....=1#post5530453. Short-answer RC6 is still in a development phase and the method signatures are not yet finalized.

  6. #86
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    234

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    ... .. .
    As for detection, whether a given target-system already contains this runtime, ... .. .
    ... .. .
    If you ask your user beforehand like this:
    Code:
      If Len(WV.GetMostRecentInstallPath) = 0 Then 'Edge-Chromium-Webview is missing on this system
         If MsgBox("The needed MS-WebView2-runtime is missing," & vbLf & "Do you want to download the installer now?", vbYesNo) = vbYes Then
            New_c.FSO.ShellExecute "https://go.microsoft.com/fwlink/p/?LinkId=2124703"
         End If
      End If
    The little 1.7MB MS-Executable from that download above, will then determine which system the User actually runs (Win7, Win8, Win10) -
    and then download and install the larger (about 50MB-80MB) and properly matching evergreen-runtime which will work best on the given system.

    HTH

    Olaf
    Thanks a LOT, Olaf! I was thinking of doing the detection myself via a tiny function but then I also thought some function must be already existing. And, there it is! Thanks.

    Kind regards.

  7. #87
    Addicted Member
    Join Date
    Apr 2017
    Location
    India
    Posts
    234

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Thanks jpbro. Both the procedures work now!

    Kind regards.

  8. #88
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hello,

    Using RC6 cWebView2 with the latest Evergreen version of Webview2, on some sites (especially Google sites: Google News, Google Play Store ...) the DocumentURL and DocumentTitle properties remain an empty string once the page is completely displayed.
    This does not happen with old fixed versions of webview2 !
    Have you encountered this problem?
    Is this a Microsoft regression or an RC6-Webview interface problem or Google sites issues ?
    Best regards

    Note: I am using RC6 6.0.9 on Windows 10

  9. #89

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by saturnian View Post
    Hello,

    Using RC6 cWebView2 with the latest Evergreen version of Webview2, on some sites (especially Google sites: Google News, Google Play Store ...) the DocumentURL and DocumentTitle properties remain an empty string once the page is completely displayed.
    This does not happen with old fixed versions of webview2 !
    Have you encountered this problem?
    Is this a Microsoft regression or an RC6-Webview interface problem or Google sites issues ?
    I was able to reproduce that, and the reason is, that Google since a few weeks apparently insists (on some of their Sites) on "higher security" for the eval-function (when called from "self-assigned scripts" - which I use so far, to resolve window-Properties via jsProp Get/Let - as e.g. jsProp("document.title").

    Came up with a workaround for the Eval-Function (which formerly worked behind WV.jsProp Get/Let) -
    and it will be present in the next Release 6.0.10... (want to wait until SQLite 3.37 gets released at december 1'th)

    Olaf

  10. #90
    Lively Member saturnian's Avatar
    Join Date
    Dec 2017
    Location
    France
    Posts
    75

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    I was able to reproduce that, and the reason is, that Google since a few weeks apparently insists (on some of their Sites) on "higher security" for the eval-function (when called from "self-assigned scripts" - which I use so far, to resolve window-Properties via jsProp Get/Let - as e.g. jsProp("document.title").

    Came up with a workaround for the Eval-Function (which formerly worked behind WV.jsProp Get/Let) -
    and it will be present in the next Release 6.0.10... (want to wait until SQLite 3.37 gets released at december 1'th)

    Olaf
    thank you for these details, Olaf
    I will wait for RC6 version 6.0.10.
    Thank you again for this fantastic work !

    François

  11. #91
    New Member
    Join Date
    Nov 2021
    Posts
    1

    Re: VB6 WebView2-Binding (Edge-Chromium)

    // Deutsch
    Sehr geehrter Herr Schmidt,

    ich hätte gern gewusst, ob Sie das webResourceRequested-Event in RC6.DLL zur Verfügung stellen können, sowie wie Sie ans ICoreWebView2-Interface dran kommen können.

    Vielen Dank im Voraus für Ihre Rückmeldung!

    Mit freundlichen Grüßen
    Igli Kapri

    // Englisch
    Dear Mr. Schmidt,

    I would like to know whether You can provide the webResourceRequested-Event in RC6.DLL as well as how You find the ICoreWebView2 interface in .NET.

    Thank you very much in advance for Your response!

    Kind regards,
    Igli Kapri

  12. #92
    New Member
    Join Date
    Nov 2021
    Posts
    9

    Unhappy Re: VB6 WebView2-Binding (Edge-Chromium)

    vb6+cwebview2 is good thing

    but did somebody know why could not upload file in vb6 cwebview2 edge browser?

    some web could, but most important web could not use web file upload system. What a pity.Name:  fcff.jpg
Views: 2923
Size:  12.9 KB

  13. #93
    New Member
    Join Date
    Nov 2021
    Posts
    5

    Re: VB6 WebView2-Binding (Edge-Chromium)

    How can I click a button on the page?

    I have tried

    WV.jsRun ("document.getElementById('btnSubmit').click")

    But nothing happened

  14. #94
    New Member
    Join Date
    Mar 2021
    Posts
    6

    Re: VB6 WebView2-Binding (Edge-Chromium)

    In WebViewInit
    'we can predefine our own set of js-functions, before any document gets loaded
    WV.AddScriptToExecuteOnDocumentCreated "function ElementClick(myElement){ window.document.getElementById(myElement).click(); }"

    'after document load we can use
    WV.jsRun "ElementClick", "btnSubmit"

  15. #95

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by talatoncu View Post
    WV.jsRun ("document.getElementById('btnSubmit').click")
    jsRun is thought for function-calls, which allow you to pass parameters as normal VB-Vars.

    For such longer "multi-dotted-expressions" (with "inner, literal-arguments"), you are better advised to use:
    WV.ExecuteScript "document.getElementById('btnSubmit').click()"

    Please note the trailing parentheses behind the last methodname "click".

    Olaf

  16. #96
    New Member
    Join Date
    Nov 2021
    Posts
    5

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    jsRun is thought for function-calls, which allow you to pass parameters as normal VB-Vars.

    For such longer "multi-dotted-expressions" (with "inner, literal-arguments"), you are better advised to use:
    WV.ExecuteScript "document.getElementById('btnSubmit').click()"

    Please note the trailing parentheses behind the last methodname "click".

    Olaf
    Perfect!

    Thank you very much Sir!

    You saved my life with this implementation and your immediate answer.

  17. #97
    New Member
    Join Date
    Dec 2021
    Posts
    6

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hi.

    Unfortunately, due to the security feature of the Edge Browser, I cannot access local files, e.g. something like this: file: /// C: /Pictures/loading.gif

    Error message in the console: Not allowed to load local resource

    How can I change the security settings to allow local resources?

    thx Andreas

  18. #98

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by EasyOneX View Post
    Unfortunately, due to the security feature of the Edge Browser, I cannot access local files, e.g. something like this: file: /// C: /Pictures/loading.gif

    Error message in the console: Not allowed to load local resource

    How can I change the security settings to allow local resources?
    There's a huge deal of influence possible, via the CommandLine-Parameter of the intial Binding-Call...

    I've posted a Link to it already in an earlier posting here in this thread,
    but here is it again (already jumping to a setting which might work for you):
    https://peter.sh/experiments/chromiu...ess-from-files

    If this specific one doesn't, other flags might do the job (perhaps google a bit about it,
    using the term CEF in your searches).

    Olaf

  19. #99
    New Member
    Join Date
    Dec 2021
    Posts
    6

    Resolved Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    There's a huge deal of influence possible, via the CommandLine-Parameter of the intial Binding-Call...

    I've posted a Link to it already in an earlier posting here in this thread,
    but here is it again (already jumping to a setting which might work for you):
    https://peter.sh/experiments/chromiu...ess-from-files

    If this specific one doesn't, other flags might do the job (perhaps google a bit about it,
    using the term CEF in your searches).

    Olaf
    Perfect. I hadn't seen the page with the commandlines yet. That's great. Thank you very much and happy holidays I wish you...

    Thx Andras

  20. #100
    New Member
    Join Date
    Dec 2021
    Posts
    6

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Thanks for the link. I hadn't seen the website yet. I wish many dear and happy holidays...

  21. #101
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 WebView2-Binding (Edge-Chromium)

    I know that using chromedirver. can intercept the image of the specified element
    By the following command
    /session/" & m_StrSessionId & "/element/" & m_StrElementId & "/screenshot.

    Private Sub cmdCaptureWV_Click()
    Dim Srf As cCairoSurface
    Set Srf = WV.CapturePreview(CaptureAs_PNG) 'capture the current WV-Window as a Cairo-Image-Surface
    Srf.WriteContentToPngFile App.Path & "\WV_Capture.png" 'which we can now visualize, or just write out as a PNG-file
    End Sub
    Do you support this function?

  22. #102

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xxdoc123 View Post
    I know that using chromedirver. can intercept the image of the specified element
    By the following command
    /session/" & m_StrSessionId & "/element/" & m_StrElementId & "/screenshot.

    Do you support this function?
    No, there's no Element-based ScreenShot-feature (what's built-in, is working Window-based).
    One could get around making that "bigger ScreenShot" -
    then getting the surrounding rect of the Element via javascript -
    followed by cutting out the Sub-Bitmap using these coords...

    But if this is for Unit-Testing... that's what chromedriver is made for and specialized in
    (not only with regards to the ScreenShot-feature) ... so, why not use it furhter?

    Olaf

  23. #103
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 WebView2-Binding (Edge-Chromium)

    We know that Google Chrome can set the capabilities parameter to customize the functions of the browser through chromdirver. I don’t know if you have this setting.For example: disable camera ...


    I want to replace the js function loaded in the original webpage.how can i do
    Originalfunnctio is checkCamera

    WV.ExecuteScript "checkCamera= function myfunction(){}" ?

  24. #104
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 WebView2-Binding (Edge-Chromium)

    We know that Edge-Chromium can set the capabilities parameter to customize the functions of the browser through Edgedirver. I don’t know if you have this setting.For example: disable camera ...


    I want to replace the js function loaded in the original webpage.how can i do
    Originalfunnctio is checkCamera

    WV.ExecuteScript "checkCamera= function myfunction(){}" ?
    Last edited by xxdoc123; Dec 30th, 2021 at 11:56 PM.

  25. #105

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xxdoc123 View Post
    I don’t know if you have this setting.For example: disable camera ...
    As already said a few posting further above - there is a ton of startup-settings,
    you can set and combine via the commandline-parameter of the initial Bind-Call.

    Here is the link again: https://peter.sh/experiments/chromiu...line-switches/
    (if you search via <Ctrl><F>, you will find a lot things to influence "media" or "capture"-behaviour.)

    Olaf

  26. #106
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 WebView2-Binding (Edge-Chromium)

    thanks.

    I am not very proficient in JS.I have to try to use Js.

  27. #107
    New Member
    Join Date
    Mar 2013
    Location
    Italy
    Posts
    1

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hi Olaf and thanks for your great work!
    I have a "stupid issue" to report regarding UserContextMenu event: the ScreenY argument declaration is spelled wrong: "SreenY"
    Someting more serious: are you planning to map the NavigationStarting Event in the vb6 wrapper so that is possible to detect the destination url before the navigation effectively occurs?

    Ciao,
    DR

  28. #108
    Lively Member
    Join Date
    Aug 2016
    Posts
    112

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hi Olaf

    I have a question regarding RC6.WebView2.

    Is there a way to download an image resource instead of opening it in WebView2? By using Navigate, the image is opened in WebView2 instead of invoking the download operation. I'd like that image to be downloaded the way I navigate to a zip file.

    Well, I know I could get the image url and use a separate httpclient to download the file. But anyway to use the WebView2?

    Plus it doesn't seem the RC6.WebView2 provide anything related to downloading.

    Thanks in advance.

  29. #109
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hello,

    I downladed RC6 a few days ago from vbRichClient.com and I registered RC6.dll with the aid of RegisterRC6inPlace.vbs.
    Then I installed the "evergreen-WebView2-runtime" via the MS-download-link.

    I tried to run WebView2Demo.vbp, got the error "Procedure declaration does not match description ..." and corrected the code as explained in post #60.

    Now I expected the demo to run, but it always stops in the following line:
    Code:
    If WV.BindTo(picWV.hWnd) = 0 Then MsgBox "couldn't initialize WebView-Binding": Exit Sub
    with the following error message:
    "Runtime Error 53:
    Error in FindFirstFile: ErrNum: 3, The system cannot find the path specified."


    (I'm using VB6 Version 8176 under Win10Pro).

    Any ideas what is wrong or what I did wrong?

  30. #110

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by C--E View Post
    Hello,

    I downladed RC6 a few days ago from vbRichClient.com and I registered RC6.dll with the aid of RegisterRC6inPlace.vbs.
    Then I installed the "evergreen-WebView2-runtime" via the MS-download-link.

    I tried to run WebView2Demo.vbp, got the error "Procedure declaration does not match description ..." and corrected the code as explained in post #60.

    Now I expected the demo to run, but it always stops in the following line:
    Code:
    If WV.BindTo(picWV.hWnd) = 0 Then MsgBox "couldn't initialize WebView-Binding": Exit Sub
    with the following error message:
    "Runtime Error 53:
    Error in FindFirstFile: ErrNum: 3, The system cannot find the path specified."


    (I'm using VB6 Version 8176 under Win10Pro).

    Any ideas what is wrong or what I did wrong?
    There seems to be a problem with the installation of the WebView-Runtime...

    The BindTo-call is looking for the WebView-Runtime-BaseFolder via the following Path-Expression:
    (for your Immediate-Window):
    ?New_c.FSO.GetSpecialFolder(CSIDL_PROGRAM_FILESX86) & "\Microsoft\EdgeWebView\Application"

    When I paste the above into my immediate-window (followed by pressing <Return>),
    then it prints out:
    C:\Program Files (x86)\Microsoft\EdgeWebView\Application

    This path exists on my machine (when I paste it into Explorer.exe, it shows the content)...

    Under this path, the BindTo-call then continues, to list determine the Folder with the highest Version-Number...

    So, could you check what your immediate-window says, the Base-InstallPath of the WebView-runtime is -
    and whether it exists on your machine?

    HTH

    Olaf

  31. #111
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Re: VB6 WebView2-Binding (Edge-Chromium)

    The output of the Immediate Window is: C:\Program Files (x86)\Microsoft\EdgeWebView\Application
    This path does not exist on my machine!

    Some minutes ago I re-installed "evergreen-WebView2-runtime" via the MS-DownloadLink, which took place without problems (which was also the case during the first installation), and now the path \EdgeWebView\Application exists and the demo program is running!

    Thank you very much for your quick help!

  32. #112
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Save As is not available in web pages

  33. #113

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by xxdoc123 View Post
    Save As is not available in web pages
    "Save As..." is available in the Default-Context-menu...
    and it will work, when you do not run elevated as an Administrator (as is the case e.g. in the IDE)...

    When you run a compiled version, it should pop-up the FileDialog (for you to choose a Save-target).

    (MS knows about the problem in Admin-Mode, there is a ticket for it: https://github.com/MicrosoftEdge/Web...ack/issues/802)

    HTH

    Olaf

  34. #114
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    673

    Re: VB6 WebView2-Binding (Edge-Chromium)

    thanks

  35. #115
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Once again thanks to Olaf for his help and generally for his great work!

    Now I'm succesful with the WebView2Demo.vbp, added a second picturebox named "Pchart" and wanted to copy the let's say "browsing result", i.e. the image in picWV, into this second picturebox. I tried:
    PChart.Picture = picWV.Image
    but obviously that doesn't work.
    Any ideas on how to get this done?

  36. #116

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by C--E View Post
    PChart.Picture = picWV.Image
    but obviously that doesn't work.
    The PictureBox picWV which is used in the Demo, is only providing "a Container-hWnd" for the Browser-instance,
    (which places its own Browser-hWnd as a Child inside the picWV.hWnd).

    But there is a builtin Method, which captures the current Browser-Content as a Pixel-Graphic
    (returning a cCairoSurface-Object, which you can use for all kind of purposes, e.g. writing to a PNG-ByteArray or -File for example)

    Long story short - please try:
    Set PChart.Picture = WV.CapturePreview(CaptureAs_PNG).Picture

    Olaf

  37. #117
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Re: VB6 WebView2-Binding (Edge-Chromium)

    I saw the following part in the demo:
    Dim Srf As cCairoSurface
    Set Srf = WV.CapturePreview(CaptureAs_PNG) 'capture the current WV-Window as a Cairo-Image-Surface
    Srf.WriteContentToPngFile App.Path & "\WV_Capture.png" 'which we can now visualize, or just write out as a PNG-file
    but was not able to transform this into the syntax:
    Set PChart.Picture = WV.CapturePreview(CaptureAs_PNG).Picture

    Long story short: You code works like a charm - thank you very much!!!

    Best Regards
    C-E

  38. #118

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by C--E View Post
    I saw the following part in the demo:
    ...
    was not able to transform this into the syntax:
    Set PChart.Picture = WV.CapturePreview(CaptureAs_PNG).Picture
    The above "one-liner" is just making use of a compiler-feature,
    which creates a (hidden) temporary cCairoSurface-instance under the covers,
    (from the return-value of the CapturePreview-method) before accessing its Picture-Property...

    The PNG-output code could have been written in one line as well -
    I just wanted to make it more obvious, what CapturePreview returns.

    A cCairoSurface is just a wrapper-class around a "32Bit-Per-Pixel DIB-allocation" in system- (not GPU-) memory -
    but also the entry-point into powerful cairo-based (Vector-)Drawing-Commands, which are just "one context-call" away.

    E.g. you could easily draw "additional stuff on it" (before placing such a Surface on a PictureBox),
    for example - if you want to "frame" the Browser-ScreenShot, you could do it this way:
    Code:
      Dim Srf As cCairoSurface 'make the returned Surface explicit
      Set Srf = WV.CapturePreview(CaptureAs_PNG)
      With Srf.CreateContext 'enter Drawing-Mode
        .SetLineWdth 2
        .Rectangle 0, 0, Srf.Width, Srf.Height, True 'define a Rectangle-Path
        .SetSourceColor vbRed, 0.5 'define the Border-Color with 50% Alpha
        .Stroke 'strokes only the Outline of the Path (not the interiour of the Rect)
      End With
      Set PChart.Picture = Srf.Picture 'now assign the combined result to the PicBox
    HTH

    Olaf

  39. #119
    New Member
    Join Date
    Dec 2021
    Posts
    6

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hi, everyone.

    Also, is it possible to auto-fit a text box to the available width and height so that when the shape is resized, the text box will also resize proportionally to the available area?

    From this :
    Code:
    <textarea id=txt1 cols=50 rows=4></textarea>
    to this:
    Code:
    <textarea id=txt1 height:auto width:auto></textarea>
    Kind regards

    Andrew

  40. #120
    New Member
    Join Date
    Feb 2022
    Posts
    7

    Re: VB6 WebView2-Binding (Edge-Chromium)

    @Olaf First of all fantastic work!! One question:
    Would it be possible to extend cWebView2 with a callback when basic authentication is requested from a site so I can provide with user name and password and thereby prevent the Sign in prompt? I.e. my hybrid app first requires a login by the user, and when navigating to my site an additional "Sign in" is currently now needed. Earlier when using the embedded IE control this was automatically handled by WinInet.

    Thanks in advance

Page 3 of 12 FirstFirst 123456 ... 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