Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: Interface not supported -2147418113
#1
Hi there. I am currently trialing the control for use within my vb6 application.
Everything is working as it should but I am not able to bind Document.CurrentBrowser = EdgeWebBrowser

My code that I am using is below:

Quote:Private WithEvents Document As AntViewAx.AntViewDocument

Private Sub Form_Load()

Set Document = CreateObject("AntViewAx.AntViewDocument")
EdgeWebBrowser.CreateWebView
EdgeWebBrowser.Navigate "https://leadvault.local/full-player.html"

End Sub

Private Sub MapLocalFolderToHostName()

  Dim Path As String
  Dim HostName As String
 
  Path = "C:\Users\Public\Documents\AntView\Examples\VB\html2"
  HostName = "leadvault.local"
  EdgeWebBrowser.SetVirtualHostNameToFolderMapping HostName, Path, hrakAllow
  EdgeWebBrowser.UserDataFolder = Path

End Sub

Private Sub EdgeWebBrowser_OnExecuteScript(ByVal HResult As Long, ByVal JsonObject As String)
  Dim Json As String
 
  ' Use the Document json decode function to make the result more readable
  Document.CurrentBrowser = EdgeWebBrowser
  Json = Document.DecodeJsonObjectString(JsonObject)
  If Json <> "" Then
    MsgBox Json
  End If
End Sub


If anyone could help, that would be great
Reply
#2
Hello,

Thank you for your question.

I can confirm the issue and am looking into it.
Currently still in "scratching behind my ear" phase wondering why it doesn't work in VB6 while this works in VBA and elsewhere.

--
Wil
Reply
#3
No worries, hopefully we can figure out a work around
Reply
#4
Hello again,

Sadly I had no time to look into this yesterday as I had another VB6 issue to chase down, but this morning I did manage to find a workaround for your problem.

Whereas it works OK in VBA, it seems like that VB6 does not get the dispatch pointer of the object. Even if you had the dispatch pointer of the object, it does not let you assign that to the CurrentBrowser property which takes the specified interface dispatch pointer.

The workaround I have is twofold.
First, a function has been added to the browser control to expose the dispatch pointer.
Secondly, a new method was created for the document interface so that you can connect the AntView Browser object via that dispatch pointer.
With that, it all seems to work OK in Visual Basic as well.

I will have a test version for you this evening or tomorrow as this afternoon I'm having some time away from the computer  Big Grin

Hope this helps,
--
Wil
Reply
#5
Thanks Wil. Looking forward to using this feature
Reply
#6
I have send a private build to test via email.

edit: For others reading this.
In the next release of the control the change needed in the code above looks like this
Code:
Private Sub EdgeWebBrowser_OnExecuteScript(ByVal HResult As Long, ByVal JsonObject As String)
  Dim Json As String

  ' Use the Document json decode function to make the result more readable
  Document.BrowserDispatch (EdgeWebBrowser.IDispatchPointer)
  Json = Document.DecodeJsonObjectString(JsonObject)
  If Json <> "" Then
    MsgBox Json
  End If
End Sub

IOW, the line that starts with Document.CurrentBrowser is replaced with the line starting with Document.BrowserDispatch

Edit2: Originally the property exposing the IDispatch pointer was named "Dispatch" but there was a name clash when using Delphi, so the new property name eventually is IDispatchPointer.
--

Wil
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)