WebBrowser Application Error |
Post Reply |
Author | |
LightRock
Newbie Joined: 16 January 2008 Status: Offline Points: 8 |
Post Options
Thanks(0)
Posted: 14 April 2008 at 3:21am |
Hi
I am receiving an application error when hosting a WebBrowser control within a VB ActiveX control and using the SetObjectForScripting (if you remove it there is no error).
I guess it is a problem with the clean up when the control is destoyed (it happens on exit of the .exe or VB itself in design time).
I am hosting your control in another because I extensively use the MSHTML functionality for HTML editing but also need the ability for HTML to call functionality within the application.
Any thoughts?
David
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
Small sample will be great :)
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
LightRock
Newbie Joined: 16 January 2008 Status: Offline Points: 8 |
Post Options
Thanks(0)
|
uploads/20080414_042921_codejock.zip
Hi
Attached is a sample of both control and app in the most basic form possible. If you build and register the control and then build the app, the error occurs when closing the .exe.
(Environment: VB6 (SP5) Extreme 11.2.2 / Windows 2000 (SP4) or XP)
Thank you
David
(Can only assume it's to do with binding the function on the control rather than a form)
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Thanks. Ye, problem that need to release ObjectForScripting.
You can add public method and call it from container:
Public Sub BeforeUnload()
WebBrowser1.SetObjectForScripting Nothing End Sub ....
Private Sub Form_Unload(Cancel As Integer)
UserControl11.BeforeUnload End Sub |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
LightRock
Newbie Joined: 16 January 2008 Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Thanks Oleg, works a treat!
|
|
LittleJK
Senior Member Joined: 13 April 2006 Status: Offline Points: 168 |
Post Options
Thanks(0)
|
Hi we are having a similar problem but we cannot get the scripting errors to stop by using webbrowser.setobjectForscripting. We have the webbrowser control inside of our application.
below is the snippet of where we are calling it. When we set the setobjectforscripting... it still comes back with scripting errors Private Sub Form_Load() On Error GoTo handle_error Screen.MousePointer = vbHourglass sDefaultPage = "http://intranet.woodloch.com/roomready" Me.web.Navigate sDefaultPage Me.web.setObjectForScripting Me bFrmLoaded = True GoTo doneSub handle_error: bFrmLoaded = False Call objErrHandler.HandleError(Err.Number, Me.Name & ".Form_Load", Err.Description) doneSub: Screen.MousePointer = vbDefault End Sub |
|
LightRock
Newbie Joined: 16 January 2008 Status: Offline Points: 8 |
Post Options
Thanks(0)
|
Hi
You can stop the standard script warnings by simply adding:
WebBrowser1.ScriptErrorsSuppressed = True
However it does require the 'Disable script debugging' in the advanced settings of IE to be checked, otherwise you get a debug error.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |