?
Solved

Running a TWebBrowser program *without* IE 4 or better

Posted on 2002-05-24
5
Medium Priority
?
155 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

752 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