Link to home
Start Free TrialLog in
Avatar of pf2
pf2

asked on

How do open up a browser...

I am writing a Delphi app and would like to know how to include a link to my web site and also to my e-mail.
I would like to know how to make it so that the user just clicks and the default browser opens up and goes to my site.
I know I have to use ShellExecute but how would I go about this?
Avatar of erajoj
erajoj
Flag of Sweden image

Hi,

Simplest way:
uses ...ShellAPI; // don't forget

  ShellExecute( 0, 'open', 'http://www.mydomain.com/~MyName/StartPage.html', nil, nil, SW_SHOW );

/// John
Avatar of Greedy
Greedy

You can also do this

function MyCreateProcess(sExecutableFilePath : string): string;
var
  pi: TProcessInformation;
  si: TStartupInfo;
begin
  FillMemory(@si, sizeof( si), 0 );
  si.cb := sizeof( si );
  CreateProcess(Nil, PChar(sExecutableFilePath), Nil, Nil, False,
                NORMAL_PRIORITY_CLASS, Nil, Nil, ci, pi);
  //wait until done
  CloseHandle (pi.hProcess);
  CloseHandle(pi.hThread);
end;



ASKER CERTIFIED SOLUTION
Avatar of itamar
itamar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is how to use it.....

ShellExecute(0, 'open', 'http:\www.yahoo.com',nil,nil, SW_NORMAL);//for website...
ShellExecute(0, 'open', 'mailto:viktor@megsinet.net',nil,nil, SW_NORMAL);//for e-mail

Hope this helps =)

Regards,
Viktor Ivanov

uses fmxutils

(see online Help)

.
   executeFile('www.inprise.com','','',1);