Page 13 of 13 FirstFirst ... 310111213
Results 481 to 488 of 488

Thread: VB6 WebView2-Binding (Edge-Chromium)

  1. #481
    New Member
    Join Date
    Dec 2021
    Posts
    4

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Hello Olaf.
    I am using this excellent option of using webview2 with vb6, I have managed to make functions to interact with the elements of some websites, but I found a problem that I have been struggling with for days, this is when simulating the click() event in an Input of type File, it simply does not open the file chooser dialog, when opening devtools the following alert can be displayed "File chooser dialog can only be shown with a user activation", I understand that this is a security block, but I want to know if There is the option to bypass that restriction.

    Here I show the return message in the DevTools
    Attachment 191017

    Best regards.
    Last edited by JoseLiza; Apr 3rd, 2024 at 12:29 AM.

  2. #482

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,289

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by JoseLiza View Post
    I have managed to make functions to interact with the elements of some websites, but I found a problem that I have been struggling with for days, this is when simulating the click() event in an Input of type File, it simply does not open the file chooser dialog, when opening devtools the following alert can be displayed "File chooser dialog can only be shown with a user activation"

    I understand that this is a security block...
    Then don't fight it (within the Browser-Control)...

    The nice thing about these "Dual-Apps" is, that you can always choose the side more suited for the task -
    so why not show a modal FileOpen-Dialog via VB6-code?

    Olaf

  3. #483
    New Member
    Join Date
    Dec 2021
    Posts
    4

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by Schmidt View Post
    Then don't fight it (within the Browser-Control)...

    The nice thing about these "Dual-Apps" is, that you can always choose the side more suited for the task -
    so why not show a modal FileOpen-Dialog via VB6-code?

    Olaf
    Using the vb6 FileOpen-Dialog would not allow assigning the path of the selected file in the file type input, since I am trying to upload a file to a website.
    If I'm wrong, I would appreciate if you could guide me on it.

  4. #484
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,636

    Re: VB6 WebView2-Binding (Edge-Chromium)

    The way I handle resizing is to set the form font to the control font and then use TextWidth with the text to determine the width and then size the control to whatever number it gives me back plus a little buffer.

    It only works on one-liners though - like labels and single-line textboxes. I've never tried it with multiline textboxes.

    I use it for all controls (that are one-lines) that I want to resize at run-time such as labels, check and optionboxes and single-line text boxes.



    Code:
    Private Function ResizeCheckBox(ByRef Check As Control, ByRef Form As Form, Optional ByRef Padding As Long = 0) As Long
    Dim nWidth As Long
    
    ' Returns CheckBox width.
    On Error GoTo errHandler
    
    CopyFontFromControl Check, Form
    
    nWidth = Form.TextWidth(Check.Caption)
    
    nWidth = nWidth + CHECKBOX_PADDING + Padding
    
    Check.Width = nWidth
    
    ResizeCheckBox = nWidth
    
    Exit Function
    
    errHandler:
    Dim nErrorNumber As Long
    Dim nErrorHandlerResult As Long
    Dim sError As String
    Dim nErr As Long
    Dim Parameters(1) As String
    
    sError = Error
    nErrorNumber = Err
    
    Parameters(0) = "Check.Name = " & Check.NAME
    Parameters(1) = "Check.Parent.Name = " & Check.Parent.NAME
    
    nErrorHandlerResult = ErrorHandler(sError, nErrorNumber, ParameterString(Parameters), NAME & ".ResizeCheckBox(Private Function)")
    
    Resume CleanUp
    
    End Function
    
    
    Public Function CopyFontFromControl(ByRef FromControl As Object, ByRef ToControl As Object) As Long
    
    ' Returns Error Code.
    On Error GoTo errHandler
    
    With ToControl.Font
    
      .Bold = FromControl.Font.Bold
      .Charset = FromControl.Font.Charset
      .Italic = FromControl.Font.Italic
      .NAME = FromControl.Font.NAME
      .Size = FromControl.Font.Size
      .Strikethrough = FromControl.Font.Strikethrough
      .Underline = FromControl.Font.Underline
      .Weight = FromControl.Font.Weight
    
    End With
    
    Exit Function
    
    errHandler:
    Dim nErrorNumber As Long
    Dim nErrorHandlerResult As Long
    Dim sError As String
    Dim Parameters(1) As String
    
    CopyFontFromControl = Err
    
    nErrorNumber = Err
    sError = Error
    
    Parameters(0) = "FromControl.Name = " & FromControl.NAME
    Parameters(1) = "ToControl.Name = " & ToControl.NAME
    
    nErrorHandlerResult = ErrorHandler(sError, nErrorNumber, ParameterString(Parameters), NAME & ".CopyFontFromControl(Public Function)")
    
    End Function

  5. #485
    Addicted Member
    Join Date
    Feb 2015
    Posts
    176

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by SearchingDataOnly View Post
    (From dm)
    .....but the problem is that if a commercial software can only run in a Windows environment, its market demand and market share will be very low. Such softwares cannot form a solid software ecological chain, nor can they provide you with more resources.
    Not quite true. Even in 2024 - some 4 years after this post - MS Windows still dominates the desktop, especially in productivity applications. And yes, there is still a smaller-than-in-the-past but re-growing market for desktop apps on Windows. Windows has always had - and likely always will - far more available software for most any conceivable desktop purpose then MAC OS and Linux combined. And I don't even want to go down the Linux mess rabbit hole - WAY too many "Distros", WAY to much incompatibility among them etc. so Linux is best left where it shines most - the server side.

    One can still build, sell and maintain good quality commercial 32-bit desktop apps with VB6. I've done it not so long ago and I plan to again. My users/customers can't tell/don't know/don't care what language their tools are written in.

    And now, with twinBasic up-and-coming, it's only going to get better!

  6. #486
    Addicted Member
    Join Date
    Feb 2015
    Posts
    176

    Re: VB6 WebView2-Binding (Edge-Chromium)

    Quote Originally Posted by SearchingDataOnly View Post
    (From dm)
    .....but the problem is that if a commercial software can only run in a Windows environment, its market demand and market share will be very low. Such softwares cannot form a solid software ecological chain, nor can they provide you with more resources......
    \
    Not quite true. Even in 2024 - some 3.5 years after this post, MS Windows still dominates the desktop, especially for productivity apps. There is still a smaller-than-before but re-growing market for commercial desktop applications. Windows has always had and likely always will have a much, much wider selection of available software than MAC OS & Linux combined. And the Linux desktop mess only makes it worse i.e. WAY to many "Distros", WAY too many incompatibilities between them, endless searches for needed dependencies, etc.

    One can still create, use and sell good quality commercial software with VB6. I've done it not so long ago and I plan to again. Some on this forum have also and still are.The core VB6 runtime will be supported until at least 2031 and likely beyond.

    My users/customers/groupies can't tell/don't know/don't care what programming language their tools are written in. They just fire 'em up and away they go.

    And with twinBasic on the playing field, its just gonna get even better .
    Last edited by SomeYguy; Apr 24th, 2024 at 08:53 PM.

  7. #487
    New Member
    Join Date
    Apr 2024
    Posts
    1

    Re: VB6 WebView2-Binding (Edge-Chromium)

    DOCUMENT.ACTIVEELEMENT ??

    Hi, Does anyone know how to use document.activeelement in webview2 please. Im struggling a bit, any code about how to set it up. Thanks very much

  8. #488
    New Member
    Join Date
    May 2024
    Posts
    3

    Re: VB6 WebView2-Binding (Edge-Chromium)

    IT IS POSSIBLE TO EXTRAPOLATE TEXT FROM A WEB PAGE WITH WEBVIEW2. Thank you

Page 13 of 13 FirstFirst ... 310111213

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