Link to home
Start Free TrialLog in
Avatar of andru
andru

asked on

Open Web browser with local html document

Hi Ppl

Just a quick one, how do I trigger the default web browser with a preprepared html document from within an application?

TIA
Avatar of Ratje
Ratje

u could try :


shellexecute(handle,'open','YourHTMFileHere',nil,nil,SW_SHOW);
ASKER CERTIFIED SOLUTION
Avatar of calinutz
calinutz
Flag of Romania image

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
Avatar of andru

ASKER

Err, how do I call shellexecute? It aint exactly a Delphi method.

TIA
Avatar of Mohammed Nasman
add

uses ShellAPI
Avatar of andru

ASKER

K, here is the code I'm using

procedure Tmap_form.trefach_menu_itemClick(
      Sender: TObject);
var
  s:string;
  p:pansichar;
begin
  s:=application_path+'trefach\trefach.htm'+#0;
  p:=@s;
  shellexecute(handle,'open',p,nil,nil,SW_SHOW);
end;

where am I going wrong?

TIA
why not make s a PChar

s : PChar;
s:=application_path+'trefach\trefach.htm';
shellexecute(handle,'open',s,nil,nil,SW_SHOW);

and make sure that s contains

application_path\trefach\trefach.htm

and not

application_pathtrefach\trefach.htm

Works for me
procedure Tmap_form.trefach_menu_itemClick(
     Sender: TObject);
var
  s:string;
begin
  s:=application_path+'trefach\trefach.htm';
  shellexecute(handle,'open',PChar(s),nil,nil,SW_SHOWNORMAL);
end;
Avatar of andru

ASKER

Err, application_path already has a backslash at the end.

TIA