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.
That seemed silly. I turned off "Old-style class parameter argument", then the extractfilepath worked.
Gene.
> 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
We used to just get the absolute path I think.
Larry.
"Gene" <shen...@yahoo.ca> wrote in message
news:4865eef2$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