Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WebBrowser1.Navigate help!!!!

0 views
Skip to first unread message

Kane

unread,
Aug 24, 2002, 11:45:47 PM8/24/02
to
Hi everyone!!

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


xandarey

unread,
Aug 25, 2002, 1:43:33 AM8/25/02
to
"Kane" wrote

> Hi everyone!!
>
> 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 ?

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


AlanGLLoyd

unread,
Aug 25, 2002, 3:45:40 AM8/25/02
to
In article <LoY99.683$YL4.1...@newsserver.ip.pt>, "Kane"
<darkd...@clix.pt> writes:

>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

Kane

unread,
Aug 25, 2002, 12:17:53 PM8/25/02
to

> Try this
>
> FP := ExtractFilePath(Application.ExeName);
> SetCurrentDir(FP);
> WebBrowser1.Navigate('Help\Help.htm');
>
> Xan
>
>

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!


AlanGLLoyd

unread,
Aug 25, 2002, 3:40:20 PM8/25/02
to
In article <sp7a9.583$_U2.14...@newsserver.ip.pt>, "Kane"
<darkd...@clix.pt> writes:

>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

xandarey

unread,
Aug 25, 2002, 3:54:12 PM8/25/02
to

"Kane"


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


Kane

unread,
Aug 25, 2002, 4:09:47 PM8/25/02
to
Oh... :)
Thanks!!!


"xandarey" <xanda...@ameritech.net> wrote in message
news:EBaa9.5390$2E6.2...@newssvr28.news.prodigy.com...

Teo

unread,
Sep 16, 2002, 3:40:34 PM9/16/02
to

"Kane" <darkd...@clix.pt> schreef in bericht
news:LoY99.683$YL4.1...@newsserver.ip.pt...

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


0 new messages