Quote of the Day

Tuesday, December 06, 2005

Fun with Hyperlinks and IE

I just got a call from a client saying that they were trying to email from their application and their PC had opened up hundreds of instances of Internet Explorer and was continuing to load IE windows even as you tried to close them. Very strange.

The method we use for automatically opening a new email message window is based on a hyperlink class in the framework we use which instantiates IE and calls the navigate method. If it starts with "mailto:" it's supposed to open a new mail message using the default mail client (in this case, Outlook 2000). Here is the code that is called when the click the email label on the form:

* NavigateTo method of hyperlink class:
loBrowser = GETOBJECT("","InternetExplorer.Application")
IF TYPE("loBrowser.Name") = T_CHARACTER
WITH loBrowser
.Navigate(tcTarget, tcLocation, tcFrame)
* Do not display the browser if the URL is a mail to address.
IF NOT UPPER(LEFT(tcTarget,7)) == "MAILTO:"
.Visible = .T.
DoDefault(tcTarget, tcLocation, tcFrame )

Notice if it sees MAILTO: IE should not be made visible. This method has worked great for years. So I had them reboot the machine and try again with the same email address. Same thing. IE continued to load in some kind of endless loop fashion. Tried from another PC with same email address and it worked fine. Tried with a different email address on the PC with trouble and it worked fine, too. So what was up with this email address? It looked normal. I checked the contacts in Outlook and it looked like a normal entry there, too. Then my client noticed there was an email saved in the Drafts folder in Outlook. Lo and behold it was a blank email to this same address! We deleted it from Drafts and the problem went away! I tried re-producing the same thing on my development PC and could not get it to happen.

Don't you love it? It seems I spend more time supporting these type of Windows/Office issues than I do writing code sometimes. Anyway, just another glimpse into the typical day of a VFP programmer. Have a great day!

No comments: