Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nothing displays in Antview browser window VB6
#1
Hi I'm trying to do a simple test in VB6 before purchasing the antview control.
I add the control to my project.
In the form Load event I added:

antview1.createwebview

Then in the antview1.oncreatewebviewcompleted event I added:
antview1.navigate("www.google.com")

The screen switches from gray to white but the web page does not display
just a white screen.

I'm sure it must be something obvious I'm missing?
Reply
#2
Hi,

Yes, there's a tiny detail missing.

Instead of:
Code:
antview1.navigate("www.google.com")
try:
Code:
antview1.navigate("https://www.google.com")

WebView2 does not try to be smart on the type of URL that you are passing, so if it is missing the protocol part then it won't work.

AntView does not add that part either.
It might be something worthwhile considering to add as you are certainly not the first one who bumps into this.

Edit:
Did you notice that the control comes with VB6 examples? They are installed in the Public Documents area.
Eg. under C:\Users\Public\Public Documents\AntView
--
Wil
Reply
#3
(2023-07-12, 22:40:59)wila Wrote: AntView does not add that part either.
It might be something worthwhile considering to add as you are certainly not the first one who bumps into this.

FWIW, I have opened a ticket for this as it can be a real head scratcher whenever someone bumps into this. 
Adding "smart" features do have a tendency to work against you if not implemented very carefully.
Note that if we decide to implement this, that it will be configurable.
Obviously it is also very important that this does not break any existing code.

--
Wil
Reply
#4
(2023-07-12, 22:40:59)wila Wrote: Hi,

Yes, there's a tiny detail missing.

Instead of:
Code:
antview1.navigate("www.google.com")
try:
Code:
antview1.navigate("https://www.google.com")

WebView2 does not try to be smart on the type of URL that you are passing, so if it is missing the protocol part then it won't work.

AntView does not add that part either.
It might be something worthwhile considering to add as you are certainly not the first one who bumps into this.

Edit:
Did you notice that the control comes with VB6 examples? They are installed in the Public Documents area.
Eg. under C:\Users\Public\Public Documents\AntView
--
Wil

Yes thank you , I figured it was something minor I was missing.  I did look at the examples thanks, but I wasn't noticing that was the difference.

How can I get an extension on my trial,  I hope to complete this testing soon and place an order but my trial license expires in a day?

Thank you!!
Reply
#5
(2023-07-13, 14:33:28)KLYNCH@APTEAN.COM Wrote: How can I get an extension on my trial,  I hope to complete this testing soon and place an order but my trial license expires in a day?

Thank you!!

This works. I have just emailed you a 30 day temporary license key until August 13th.

--
Wil
Reply
#6
Hello,
So I've got my new licensed version of Antview and I am able to 
get the browser to render pages in my test project.
But in my actual project it still doesn't display anything.
Are there any other things you can think of that I can check?

Thanks
Kevin
Reply
#7
Hello Kevin,

Getting the AntView control to work in your test project is at least a good start.
Obviously you also want it to work in your normal project.

I'm not sure what is wrong as I simply miss the details for that.
When you say "But in my actual project it still doesn't display anything. "
Is the control white or does it render in the background color (usually gray)?

Perhaps it's also a good idea to turn on logging.
See this page:
https://doc.antview.dev/hs190.htm

At this stage a log set at LogMode level 1 would be sufficient for getting an idea of what is going on.
You can attach the log here to a reply or send by email to support@antwise.com

--
Wil
Reply
#8
It is showing in the default gray as if nothing is being rendered. I tried changing
it to Red just to be sure and it stays Red after the Navigation.

This is the log, it's on mode 2

Creating new log...
2023-08-22 10:40:45.463 Event OnDestroy Destroying $15038C
2023-08-22 10:40:45.463 Destroying control $0000
2023-08-22 10:40:47.335
2023-08-22 10:40:47.335 -------------------------------------------------------------------------
2023-08-22 10:40:47.335 ------ Starting new WebView2 instance ------
2023-08-22 10:40:47.335 -------------------------------------------------------------------------
2023-08-22 10:40:47.335 Application: C:\Program Files\Microsoft Visual Studio\VB98\VB6.EXE (9032)
2023-08-22 10:40:47.335 Win32
2023-08-22 10:40:47.335 Current Directory: C:\Users\klynch\AppData\Local\Temp\WinMDS
2023-08-22 10:40:47.335 AntView loaded C:\PROGRA~1\AntView\Win32\AntView.ocx
2023-08-22 10:40:47.335 AntView version 1.1.270.0
2023-08-22 10:40:47.335 User: klynch
2023-08-22 10:40:47.335 Log Level: 2
2023-08-22 10:40:47.335 Initializing defaults
2023-08-22 10:40:47.351 EventSink changed, creating inplace object $0000
2023-08-22 10:40:47.351 Reading Version = 1.1.270
2023-08-22 10:40:47.351 Configuring default userDataFolder.
2023-08-22 10:40:47.351 userDataFolder C:\Users\klynch\AppData\Local\Temp\VB6.EXE.WebView2\
2023-08-22 10:40:47.351 CreateWebViewOnCreate is set to false, not initializing WebView2 until requested.
2023-08-22 10:40:47.351 Creating window $4D08E8
2023-08-22 10:40:49.940 Test if WebView2 control is OK.
2023-08-22 10:40:49.940 Start async creation of the WebView2 control.
2023-08-22 10:40:49.940 BrowserExecutableFolder:
2023-08-22 10:40:49.956 UserDataFolder: C:\Users\klynch\AppData\Local\Temp\VB6.EXE.WebView2\
2023-08-22 10:40:49.956 Setting environment options: chrome flags: [] Language [] Min. Browser version [95.0.1020.44] Single Sign On False
2023-08-22 10:40:49.956 Reading InstallPath = C:\Program Files\AntView
2023-08-22 10:40:49.956 Trying to load the loader DLL as C:\Program Files\AntView\Win32\WebView2Loader.dll
2023-08-22 10:40:49.956 LoadLibrary "C:\Program Files\AntView\Win32\WebView2Loader.dll" result $68090000
2023-08-22 10:40:49.956 Loading from InstallPath : success.
2023-08-22 10:40:49.956 Loaded as C:\Program Files\AntView\Win32\WebView2Loader.dll
2023-08-22 10:40:49.956 Version = 1.0.1108.44
2023-08-22 10:40:49.956 Assigning loader library procedures.
2023-08-22 10:40:49.956 Assigned loader library procedures.
2023-08-22 10:40:51.511 CreateAsync Success $4D08E8
2023-08-22 10:40:51.511 WebView2 version 109.0.1518.115
2023-08-22 10:40:51.511 Event OnCreateWebviewCompleted HResult = 0x00000000 (S_OK)
2023-08-22 10:40:51.511 Navigate http://rs6000d.tshinc.com:7373/basemenus/MAIN.MENU
2023-08-22 10:40:51.528 Event OnNavigationStarting
2023-08-22 10:40:51.528 Uri http://rs6000d.tshinc.com:7373/basemenus/MAIN.MENU
2023-08-22 10:40:51.529 NavigationId 4
2023-08-22 10:40:51.530 Event OnWebResourceResponseReceived
2023-08-22 10:40:51.530 OnWebResourceResponseReceived not send as is disabled.
2023-08-22 10:40:51.633 Event OnHistoryChanged
2023-08-22 10:40:51.640 Event OnSourceChanged IsNewDocument True
2023-08-22 10:40:51.641 Event OnContentLoading IsErrorPage False NavigationId 4
2023-08-22 10:40:51.641 Event OnHistoryChanged
2023-08-22 10:40:51.642 Event OnDocumentTitleChanged : Main Menu
2023-08-22 10:40:51.643 Event OnWebResourceResponseReceived
2023-08-22 10:40:51.643 OnWebResourceResponseReceived not send as is disabled.
2023-08-22 10:40:51.644 Event OnWebResourceResponseReceived
2023-08-22 10:40:51.645 OnWebResourceResponseReceived not send as is disabled.
2023-08-22 10:40:51.645 Event OnDOMContentLoaded NavigationId 4
2023-08-22 10:40:51.646 Event OnWebResourceResponseReceived
2023-08-22 10:40:51.646 OnWebResourceResponseReceived not send as is disabled.
2023-08-22 10:40:51.647 Event OnNavigationCompleted IsSuccess True webError 0 NavigationId 4

So I was reading another thread below about the Modal form and I tried
adding:

dataform.menubrowser.visible = false
dataform.menubrowser.visible = true

and it worked, it made the webpage appear.
Not sure why it was needed though.
Reply
#9
Hi Kevin,

Hmm.. peculiar. When the control fails to instantiate it tends to come up in grey.
In that case you're basically looking at an empty wrapper that has no WebView2 control hosted in it.

From the log, the main 2 lines of interest are these, the first line indicates that we've asked the WebView2 control to instantiate itself.
Code:
2023-08-22 10:40:49.940 Start async creation of the WebView2 control.
and that's then followed by the event that triggers to notify if the control instantiated with success (S_OK) or if it failed.
Code:
2023-08-22 10:40:51.511 Event OnCreateWebviewCompleted HResult = 0x00000000 (S_OK)
When it failed it usually also comes with the particular Windows error that might give us an idea.

The peculiar bit is that it comes up as succeeded while the control does not draw the embedded WebView2 control.
In other words, the WebView2 reports that there's no problem, but it isn't getting drawn either.
I have seen this indeed happen with modal forms before and it wasn't always easy to reproduce.

Seems to have to do with the timing of the form activation process and the control it embeds. I am always interested in a reproducible case of this to see if there's nothing that can be done to detect and correct this particular behavior.

PS: Glad to hear you have a workaround.
--
Wil
Reply
#10
Thanks, one more thing I need to do is capture a message from javascript.
I have this html:
<a href="#" onclick='javascript:callMDS("F000826-Purchasing"; )'> <img src="http://rs6000d.tshinc.com:7373/basemenus/star.png"></a>

I'm not getting the events for OnWebMessageReceived or OnScriptDialogOpening being fired?
Reply
#11
Hi,

In order to receive a webmessage that is send from javascript, you need to enable it via the property WebMessageEnabled and set that to true before sending a webmessage.
The mechanism is described here: VB6 - Web Message Example.

Using script dialogs to transfer data is.. a bit non standard I guess, although I suppose it is possible.
In order to have the onScriptDialogOpening event to trigger, you have to set the property DefaultScriptDialogsEnabled to false to indicate that you want to handle the dialogs yourself.

If you can adjust the javascript to send a webmessage then that's what I would go for.

--
Wil
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)