Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > General Discussion
  New Posts New Posts RSS Feed - WebBrowser Application Error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

WebBrowser Application Error

 Post Reply Post Reply
Author
Message
LightRock View Drop Down
Newbie
Newbie


Joined: 16 January 2008
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote LightRock Quote  Post ReplyReply Direct Link To This Post Topic: WebBrowser Application Error
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2008 at 4:08am
Hi,
Small sample will be great :)
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
LightRock View Drop Down
Newbie
Newbie


Joined: 16 January 2008
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote LightRock Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2008 at 4:37am
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)
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2008 at 7:01am

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
Back to Top
LightRock View Drop Down
Newbie
Newbie


Joined: 16 January 2008
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote LightRock Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2008 at 7:42am
Thanks Oleg, works a treat!
Back to Top
LittleJK View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 April 2006
Status: Offline
Points: 168
Post Options Post Options   Thanks (0) Thanks(0)   Quote LittleJK Quote  Post ReplyReply Direct Link To This Post Posted: 04 August 2008 at 3:51pm
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
Back to Top
LightRock View Drop Down
Newbie
Newbie


Joined: 16 January 2008
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote LightRock Quote  Post ReplyReply Direct Link To This Post Posted: 05 August 2008 at 1:30am
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.