views:

27

answers:

1

Hi. I'm writing a program where an user can enter list of URLs to load and the program cycles through the URLs to load them in an IE instance one after another, like a website slideshow.

The problem is that when I enter an URL that requires some membership verification then IE shows the login prompt and practically freezes the IE window until I cancel or enter login details. I want my program to skip such cases (select cancel somehow).

Is there any way that my VB6 app can detect if a prompt is there and cancel it so the next URL can load? Thanks in advance :)

+1  A: 

Edited

Actually, you need to look for several other types of child windows as well, such as javascript alert() windows. You don't look for window captions (I was wrong) you look for window classnames.

To figure out which classnames to look for (there's not that many) I used Spy++. Then, at runtime, I called FindWindowEx() (not FindWindow(), I was wrong there) to see if IE had any child windows with those classnames. If I find one I send the Cancel click. (I think you can also send the window a WM_CLOSE message, but I'm not sure.)

I don't have my old source handy--do you need more detail?

egrunin
Thanks. Sadly the caption is not fixed, it changes from site to site. How do I handle that?
mathon12
Yes, that would be really helpful. I can find a particular window right now. I get a long value if a match is found and I think this is the window handle? How can send it the Cancel click/WM_CLOSE message? (Sorry, not well versed with the WIN32 API, thanks.)
mathon12
UPDATE: using SendMessage did the trick! :)
mathon12