|
-
Dec 9th, 2000, 08:33 AM
#1
Thread Starter
Member
I am writing a program which would create an instance of IE(version 5.51) to navigate to a site. The page I retrieve will automatically send data to this IE at a 10 seconds interval to refresh the screen. The problem was that I could not terminate this IE instance.
I create the instance of IE with the following statements:
Private WithEvents mobjIE As SHDocVw.InternetExplorer
Set mobjIE = CreateObject("InternetExplorer.Application")
then navigate to the site with :
mobjIE.Navigate strQAddr, 2
then retrieve the content of the page via :
Dim doc As HTMLDocument
Set doc = mobjIE.Document
then I tried to terminate the instance of IE using :
mobjIE.Stop
mobjIE.Quit
the program then executes the End statement.
But the IE instance is still there, and still receiving data from the site.
If the program starts up and executes again, another IE is created, taking up additional resource and very soon my machine is low in memory.
Could anyone tell me what I have done wrong ?
Help is much appreciated.
Terence
-
Dec 9th, 2000, 04:09 PM
#2
Set your object to nothing to free up it's resources.
Code:
Set mobjIE = Nothing
'
Set doc = Nothing
-
Dec 9th, 2000, 09:10 PM
#3
Thread Starter
Member
Matthew,
Thanks.
Sorry, I forgot to mention. I did set both IE and document object to nothing before my application ended. However, the IE was still there.
I did a search on MSDN and found an article "Visual Basic Component Shutdown Rules" in section Visual Basic concept. Then I suspected the coding in the web page I retrieved was executing which prevented IE to terminate. I could think of only way to stop it to execute, navigate to somewhere else. So, I add the statement :
mobjIE.gohome before mobIE.stop and .quite. But it did not work, and kept contiuously getting data from the site every 10 seconds after my program ended.
Any suggestions ?
Terence
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|