开发者

What code would let me find the compiled executable's directory? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

...Even when a user opens an application by double-clicking an associated file in a directory that's different from the executable. I've always used ExtractFilePath(Application.EXEName), but this function doesn't work开发者_Go百科 as hoped in this circumstance.


ExeName returns ParamStr(0) which in turn returns the string produced by GetModuleFileName with hModule set to 0. I cannot see any reason why this wouldn't work in a normal application.


Also try ParamStr(0). Maybe that works when application.exename doesn't?


ExePath := ExtractFilePath(paramstr(0));

I do it all the time, and it always works, whatever OS it is running on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜