?
Solved

Communication between Delphi Application and the Default Web Browser

Posted on 2004-08-25
6
Medium Priority
?
430 Views
Last Modified: 2010-04-05
Hello Experts,

How does a Delphi application communicate with the Default web browser? Let me explain the scenario. I use TIdHTTP from the Delphi app to submit variables to a PHP script called "test.php" located in 'http://anywhere/", which in turn dynamically creates the HTML code for display of a web page. This part works fine. Now the jackpot question: How do I open the DEFAULT WEB BROWSER (IE , Netscape, Opera, whatever) with the web page dynamically created by test.php? I cannot use the TWebBrowser component because it only caters for IE and therefore eliminates users with any other web browser besides IE. I have a feeling that ShellAPI or something similar could be used for this, but it probably wouldn't be straightforward. If ShellAPI is somehow the answer, I would need some example code to see the syntax.

Can anybody help?
0
Comment
Question by:JDJVR
[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
6 Comments
 
LVL 12

Assisted Solution

by:Ivanov_G
Ivanov_G earned 400 total points
ID: 11892634
save the HTML generated by test.php to TEMP file and open in default web browser using ShellExecute...
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11892656
0
 

Expert Comment

by:BaTy_GiRl
ID: 11893253

add to uses list ShellAPI

First you need to find out where is the path of you Iexplorer, or netscape my path is in Program Files

then the syntax of shell execute is


if ShellExecute(Self.Handle, nil, 'C:\Program Files\Internet Explorer\IEXPLORE.EXE','C:\readme.htm', nil, SW_SHOWMAXIMIZED) <= 32 then
    Application.MessageBox('Couldn''t execute the application','Error', MB_ICONEXCLAMATION);

where  the C:\readme.html is the file i want to open, if you want to open a file from http, just quit the C:\

Best Wishes
   B@ty



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:JDJVR
ID: 11897489
Thanks - the TEMP file solution should work, but is there any way to avoid having to save a TEMP file and still use ShellExecute?
0
 
LVL 12

Accepted Solution

by:
Lee_Nover earned 400 total points
ID: 11899891
I'd setup a HTTP server in my app (just add a TIdHTTPServer compo and set a "random" port)
get the php returned page, save it (in memory) then ShellExecute with the url having the ID of this page like: 'http://localhost:someport/?id=someid'
in the request handler of the http server just check for the id and stream the result back :)

avoiding saving to a file but will have to provide an open port
don't see any other alternatives (yet)

:)
0
 

Author Comment

by:JDJVR
ID: 11900166
Thank you, everybody. I think I will be able to do what I need to with the feedback you have given me. I'll split the points between Ivanov G and Lee Nover. I have another question which is about communication from the web page back to the Delphi app via PHP (I think I may have an idea how to do it) but I will post it as a separate question later if needed.

Cheers!
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 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