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

ExtractFilePath doesn't work when I upgrade my project from BCB6.

17 views
Skip to first unread message

Gene

unread,
Jun 28, 2008, 3:57:38 AM6/28/08
to

Hi,

I don't know why the function ExtractFilePath doesn't work on me when I ugraded my project from BCB6. The code is here:

AnsiString FName = Application->ExeName;
AnsiString path = ExtractFilePath(FName);

path is Null. It is strange. I did test on a brand new project made under C++ Builder 2007, the function works. I don't know why. Has any one had that problem before? Any clue of what is going on?

Thanks.

Gene.

Gene

unread,
Jun 28, 2008, 9:21:18 PM6/28/08
to

That seemed silly. I turned off "Old-style class parameter argument", then the extractfilepath worked.

Gene.

Remy Lebeau (TeamB)

unread,
Jun 30, 2008, 12:59:38 AM6/30/08
to

"Gene" <shen...@yahoo.ca> wrote in message
news:4865eef2$1...@newsgroups.borland.com...

> AnsiString FName = Application->ExeName;
> AnsiString path = ExtractFilePath(FName);
>
> path is Null.

The only way that can happen is if FName was empty string to begin with.
That woul suggest the Win32 API GetModuleFileName() function failed inside
of Application->ExeName somehow.


Gambit


Larry Griffiths

unread,
Jul 7, 2008, 4:28:03 PM7/7/08
to
We have something strange with ExtractFilePath(Application->ExeName) but if
I remember correctly the Application.Exe name has some ../ in it to go up a
level and then down to a directory.

We used to just get the absolute path I think.

Larry.

"Gene" <shen...@yahoo.ca> wrote in message
news:4865eef2$1...@newsgroups.borland.com...
>

Remy Lebeau (TeamB)

unread,
Jul 7, 2008, 5:55:58 PM7/7/08
to

"Larry Griffiths" <nos...@nowhere.com> wrote in message
news:48727c48$1...@newsgroups.borland.com...

> We have something strange with ExtractFilePath(Application->ExeName)
> but if I remember correctly the Application.Exe name has some ../ in it to
> go up a level and then down to a directory.

The Application->ExeName property cannot return such a value.

> We used to just get the absolute path I think.

The Application->ExeName property getter calls ParamStr(0), which calls
GetModuleFileName(), which always returns an absolute path to the file that
the calling process was spawned from.


Gambit


0 new messages