I've been using ShellExecute
to open URLs in a browser, invoked from a modal windows' code, like this:
procedure TfmAbout1.BtnHomePageClick(Sender: TObject);
begin
inherited;
if ConnectedToWeb then
ShellExecute(Handle, 'open', URL_PRODUCT_HOMEPAGE, nil, nil, SW_SHOWNORMAL);
end;
But on machines with the Zone Alarm firewall, the user may get a pop-up prompt to allow or deny my application access to the Internet. When the user clicks "Deny", then ShellExecute
never returns... my application is then hung & the process has to be shut down externally (i.e., from Task Manager).
What can I do to either anticipate or prevent this? I need something like a ShellExecute
that is non-blocking in this situation.
I'd appreciate any ideas.
ConnectedToWeb
that has the problem. ShellExecute shouldn't request network access; it just runs whatever is associated with the "http" prefix in the registry. Zone Alarm flags your program because it's attempting the access the Internet in order to determine whether the Internet is accessible. If your program doesn't actually need Internet access, then you're just making things worse because even if Zone Alarm allows a browser to have access, it might deny your program, and so your function returns incorrect results. Call ShellExecute unconditionally. – Rob Kennedy