Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

GetCurrentDir on windows boot acting funny!

Hi Guys.
I use GetCurrentDir to get the, er, Current dir. It works fine, I call it in the Initialization section of my program.

I added my software to the start-up of windows (using the registry, at currentsoftware/M$/windows/run or something like that) and then the function simply returns "c:\". Even if I move it out of the Initialization part and to the 'Activate' of the form or something, it still does that. What gives?

Cheers,

Tsh.
0
ShadowHawk071998
Asked:
ShadowHawk071998
  • 3
  • 2
1 Solution
 
esoftbgCommented:
var
  CurrDir: string;
begin
  CurrDir := ExtractFilePath(Application.ExeName);
end;
0
 
MotazCommented:
You can use ExtractFilePath(ParamStr(0)) to extract your current path even if you assign different working directory than the directory in which you put your exe file.

Example:

if your program started from d:\test\first.exe
then that function will return:
d:\test\

Motaz
0
 
ShadowHawk071998Author Commented:
Hi. This works great. But what do I do about the points?
Esoftbg helped first and his answer works, But I think Motaz also answers. Should I give points to the first one? or both somehow?

T.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
MotazCommented:
it is enough to give points for first answer
Motaz
0
 
ShadowHawk071998Author Commented:
Cheers, and sorry Motaz ;-(
0
 
ShadowHawk071998Author Commented:
Simple, but it works great ;-)

T.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now