i've got a litle prob here:
i have a dir in the app dir named Help and inside it there is a Help.htm
file i want to load into the WebBrowser1. So far so good, BUT, using the
following sintax it just don't find the file!
WebBrowser1.Navigate('Help\Help.htm');
since the *.exe is in the same dir as Help dir is, there should be no prob
right ?
but if i write the complete path ('C:\.....\Help\Help.htm') the file loads
correctly in the browser...
Anyone??? please help!!!
TIA
Windows will change the current directory at times IIRC.
>
> but if i write the complete path ('C:\.....\Help\Help.htm') the file loads
> correctly in the browser...
As the complete path is used the current directory does not matter.
> Anyone??? please help!!!
>
> TIA
>
>
Try this
FP := ExtractFilePath(Application.ExeName);
SetCurrentDir(FP);
WebBrowser1.Navigate('Help\Help.htm');
Xan
>i have a dir in the app dir named Help and inside it there is a Help.htm
>file i want to load into the WebBrowser1. So far so good, BUT, using the
>following sintax it just don't find the file!
>
>WebBrowser1.Navigate('Help\Help.htm');
>
>since the *.exe is in the same dir as Help dir is, there should be no prob
>right ?
>
Wrong <g>.
>but if i write the complete path ('C:\.....\Help\Help.htm') the file loads
>correctly in the browser...
>
Filenames used as run-time property parameters are not considered as
sub-directories (and concatenated with local directories), as compile-time
filenames are.
Either use GetCurrentDirectory or extract the local directory from ParamStr(0)
(the filepathname of the executable).
Alan Lloyd
alang...@aol.com
Im' not shure if i'm understanding it write, but i've declared the FP as a
string var and used the code above, but when running the app, the browser
still can't navigate to the needed file :(
my code looks like this:
procedure TForm2.FormCreate(Sender: TObject);
var FP: String;
begin
FP := ExtractFilePath(Application.ExeName);
SetCurrentDir(FP);
WebBrowser1.Navigate('Help\Help.htm');
end;
what am i doing wrong ??
thanks again for your help!
>procedure TForm2.FormCreate(Sender: TObject);
>var FP: String;
>begin
> FP := ExtractFilePath(Application.ExeName);
> SetCurrentDir(FP);
> WebBrowser1.Navigate('Help\Help.htm');
>end;
>
>what am i doing wrong ??
>
As I said - filenames used as parameters (as you do for WebBrowser.Navigate)
have _no_ knowledge of the current directory. They _must_ have the full
pathname _and_ filename for the file. It does not matter where the current
directory is, they must have the ful filepathname...
FP := ExtractFilePath(Application.ExeName);
WebBrowser1.Navigate(FP + 'Help\Help.htm');
.. will work.
Alan Lloyd
alang...@aol.com
Thats what happens when I code it and turn it loose. :(
WebBrowser1.Navigate('Help\Help.htm'); expect a URL so I believe to open a
file you must pass the full file path.
Compiled, tested, and working.
procedure TForm2.FormCreate(Sender: TObject);
var FP: String;
begin
FP := ExtractFilePath(Application.ExeName);
WebBrowser1.Navigate(FP + 'Help\Help.htm')
end;
Xan
"xandarey" <xanda...@ameritech.net> wrote in message
news:EBaa9.5390$2E6.2...@newssvr28.news.prodigy.com...
Kane,
You could try creating a new HTML page in Word, put an image on it.
What happens: in the HTML code, the path is referenced with
'.\help\help.htm'
I think that the solutions offered, could work, but not if you put your HTML
page on Internet..
Regards,
Teo