Click here to Skip to main content
13,558,860 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,

I have one project created with VB 6.0. Below is the code.

Step to reproduced this issue,

1. Start Internet explorer and add the site "https://subscribe.qa.s.vonagenetworks.net/plans" to trusted site. now set protected mode check box to Off for the trusted site zone.

2. Open the Visual Basic 6.0 and created standard Exe project.

3. From Tools ->; references add "Microsoft Internet Controls".

4. Copy and Paste below code.

'General Declaration

Dim WithEvents ie As SHDocVw.InternetExplorer

Private Sub Form_Load()

Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate2 "https://subscribe.qa.s.vonagenetworks.net/plans"
ie.Visible = True

End Sub


Private Sub ie_DocumentComplete(ByVal pDisp As Object, URL As Variant)

MsgBox "Document complete."

End Sub

Private Sub ie_OnQuit()

MsgBox "IE quit."

End Sub


Now the problem what I am facing is that when I ran this code It opens the IE and navigate to the given URL but suddenly it called the onQuit event though the IE is still open. If I set the Protected mode ON for the Trusted site zone it is working fine and IE_Document complete called perfectly.

I am using Windows 7 Professional and Internet Explorer 8.

May I know what is the issue? What should I do to make it run for both setting i.e. Protected Mode On or OFF.
Posted 13-Sep-10 3:57am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Why not adding a button?

I have been working with VB and
Set ie = CreateObject("InternetExplorer.Application")

and I had never any problem that IE all of a sudden quits by itself.

A piece of my code I used in the past and I'm still using :

'Create Internet Explorer Application, going on the internet!
Set ie = CreateObject("InternetExplorer.Application")

'Internet Explorer Visible
ie.Visible = True

'Internet Explorer Left & Top Position on the screen
ie.Left = 0
ie.Top = 0

'Internet Explorer Height & Width Settings
ie.Height = 1024
ie.Width = 1280

'Internet Explorer Navigate To Facebook
ie.Navigate2 "http://www.facebook.com"

To stop IE I use a command button with as code under the click event :

'Stop & Close Internet Explorer
ie.Stop
ie.Quit


-------
IE.onquit thus not advisable if you follow the MSDN Library http://msdn.microsoft.com/en-us/library/cc136549.aspx[^] if you use the WebBrowser Object http://msdn.microsoft.com/en-us/library/aa752085.aspx[^] offcourse.
  Permalink  
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04-2016 | 2.8.180515.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100