Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Running a TWebBrowser program *without* IE 4 or better

Posted on 2002-05-24
5
Medium Priority
?
160 Views
Last Modified: 2010-04-04
Hi,

I have an application written in Delphi 4 Pro and on the main form I have a TWebBrowser ActiveX control that is created dynamically in FormCreate.  Now I understand that TWebBrowser requires a minimum of IE 4 to operate correctly.  So, what would happen if the end user runs my deployed program on a computer that has an old version of IE (less than 4, or even doesn't have IE installed at all)?  Will the program crash?  Will it display an error message (if so what and is the message meaningful to the end user?)?  Will the program exit gracefully?

What is the best way to handle this situation?  Ideally, I would like do display a meaningful error message if IE 4 or better isn't installed and exit gracefully.  I could add some code to check, but I think that Delphi might not even get as far as running the code to check that IE 4 or better isn't installed on the target PC(?).

Best Regards,

Richard
0
Comment
Question by:Richard2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 26

Expert Comment

by:Russell Libby
ID: 7033022

Richard,

The best way to handle this is to wrap the web browser control creation in a try...except handler. That way if it bombs, you can get control, display the message you want, and exit gracefully.

Russell
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7034022
Take a look at http://www.euromind.com/iedelphi for EmbeddedWb component . And not only :)

0
 

Author Comment

by:Richard2000
ID: 7037461
Hi,

Thanks for your comments.  My program requires a minimum version of IE 4 for 2 reasons...

1) It uses the TWebBrowser control.
2) It uses Russell's TDownloader component that uses the asynchronous WinInet.

I'm creating all TWebBrowser and TDownloader components dynamically to give me more control.  What I had planned to do originally was test the IE version at the start in FormCreate and if IE 4 or better isn't installed, display a user-friendly error message and close down the program before any TWebBrowser or TDownloader instances are created.

The problem is that when I try to run the program on a PC that doesn't have IE 4 or better installed, Delphi doesn't seem to run the program at all - it just seems to display it's own error messages.  No code seems to be executed at all under this circumstance, so it is difficult to display a user defined message.  Using try..except blocks would not make any difference, because the code is never executed.

I have an old PC running Windows '95 with Plus! installed.  It has a very old version of IE on it.  When I run the EXE, I get 2 error messages...

1st Message

A:\Test.exe (Title)

A:\Test.exe

A device attached to the system is not functioning.

2nd Message

Error Starting Program (Title)

The TEST.EXE file is linked to missing export WININET.DLL:InternetGetConnectedState

So it never gets as far as executing the code to determine if IE 4 or better is installed.  I was hoping to be able to detect this and display a more user-friendly message such as "Sorry, Internet Explorer 4 or better is required to use this program.".  Is there any way to do this?

Of course, if I run the program on a PC with IE 4 or better installed, everything works perfectly.  I've tried the TDownloader component a lot and it works wonders (all of the changes you made last to the component seems to work fine too) - thanks Russell!

Richard
0
 
LVL 26

Accepted Solution

by:
Russell Libby earned 200 total points
ID: 7039224

Richard,

1.) Have you tried putting the try..except blocks in the program source (dpr file)?

Ex:

begin
   try
     Application.Initialize;
     Application.CreateForm(TForm1, Form1);
     Application.Run;
  except
    on E: Exception do
    begin
      // Display your error message
    end;
  end;
end;

2.) If your still unable to catch any errors, you could:
Write a small stub program that does the compatiblity checking. The user would run this program, and providing that all requirements were met, the stub program would launch your program.


Just some suggestions. Perhaps others can offer some more input to come up with a solution that works for you.

Russell
0
 

Author Comment

by:Richard2000
ID: 7056343
Hi Russell,

Many thanks for your comment.

I tried your first suggestion.  I put just a TWebBrowser on a form and put the exception handler in the dpr and it did display a custom error message when it was run on a computer without IE 4 or better installed.  However, when I added the TDownloader component I still got Delphi's own error message and it doesn't seem that in this circumstance the try..except code had any effect.  I assume that when it realises it is missing a dependent file, Delphi just displays its own error message and doesn't run any code itself.

The stub idea is an interesting one and I'll give that a try.  Although it might not be worth the extra overhead for the advantage gained (especially as virtually all PCs now have IE 4 or better installed).

Richard
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question