views:

91

answers:

1

Long story short: I'm trying to write an app that'll dump IE's history to a text file. Because I am lazy, I went searching for a preexisting library and found this beautiful project to build from: http://www.freevbcode.com/ShowCode.asp?ID=6702. Only, I'm stuck...

I finally got the program to dump the history, but it ONLY WORKS if I put a MsgBox() on line 169 of Module1.vb. I've tried putting a Thread.Sleep() there, but that doesn't work. There has to be a message box there, or only today's history gets listed.

My guess, since this is talking to wininet.dll, is this is a concurrency thing. Thread.Sleep() (for a For...Next loop) stops the program from listening, nothing there makes it exit the loop before values are assigned, but a MsgBox() is just right. Is there something besides MsgBox() that will have the same effect? I'd like to not have to hit OK thirty times to make the program work.

Here's my branch/version/derived work: http://profnano.org/andy/misc/img/HistList.zip, it's a VS.NET2003 project. Thanks for any help in advance.

+4  A: 

MsgBox() pumps a message loop. That can get all kind of code unstuck. Windows get a chance to paint themselves. COM deadlocks due the main thread getting stuck in a loop are solved, always an issue when IE is involved. Calling DoEvents() is the very imperfect alternative to MsgBox().

Hans Passant
Huh! That seemed to sort of work. DoEvents() got one more day squeezed out. I think, for this code, I'm stuck with MsgBox. Thank you.
AndyB