Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB6: Copying the entire contents of the webpage to the clipboard
#2
Hi Przemek,

Do you want the Html or the Text?

If you only want the text then you could use javascript along the lines of:
Code:
  Dim jScript As String
  Dim varParams(0) As Variant
 
  jScript = "() => {" & vbCrLf
  jScript = jScript & "document.body.textContent;" & vbCrLf
  jScript = jScript & "}" & vbCrLf
  Document.BrowserDispatch EdgeWebBrowser.IDispatchPointer
  Document.RunAnonymousFunction 2, varParams, jScript

Then on the raised event retrieve decode the json object to remove the url encoding.
Code:
Private Sub Document_OnRunAnonymousFunction(ByVal Id As Long, ByVal Params As Variant, ByVal Data As String, ByVal Error As Long)
  Dim sData as String
  If Id = 2 Then
    sText = Document.DecodeJsonObjectString(Data)
  ElseIf Id = 3 Then

I think that should be it.

Once you have the text you can add it to the clipboard in the host application.
There's no need to do that from within the browser control as the clipboard is global to the Windows session.

If you have a bit I can add the above as a function to the document control similar to the currentHtml one to make it a bit easier to use.

--
Wil
Reply


Messages In This Thread
RE: VB6: Copying the entire contents of the webpage to the clipboard - by wila - 2022-10-04, 08:49:50

Forum Jump:


Users browsing this thread: 1 Guest(s)