Application Path 
Author Message
 Application Path

Hi,
    How to get application path ? For example,There is a MyApp.EXE, when the
user run "C:\folder\MyApp.EXE", I want to get the "C:\folder\". In vb, you
can get it by app.path.

Thanks in advance!

Peter Lin



Sun, 27 Mar 2005 15:08:30 GMT  
 Application Path

Quote:

>     How to get application path ? For example,There is a MyApp.EXE,
>     when the
> user run "C:\folder\MyApp.EXE", I want to get the "C:\folder\".

GetModuleFileName(NULL, ...)
_splitpath(...)

--
Greetings
  Jochen



Sun, 27 Mar 2005 16:44:28 GMT  
 Application Path

 GetModuleFileName() can serve your purpose.
Consider the code snippet:

 char currentExePath[MAX_PROCESSEXE_PATH];
 DWORD nSize = MAX_PROCESSEXE_PATH;
 HMODULE hmod;
 hmod = GetModuleHandle(NULL);
 GetModuleFileName(hmod, currentExePath , nSize);

In your case you we will get C:\folder\MyApp.EXE in currentExePath.
Additionally,  argv[0] gives you the exe name.
Hope that helps.

-Sharad


Quote:
> Hi,
>     How to get application path ? For example,There is a MyApp.EXE, when
the
> user run "C:\folder\MyApp.EXE", I want to get the "C:\folder\". In vb, you
> can get it by app.path.

> Thanks in advance!

> Peter Lin



Sun, 27 Mar 2005 16:42:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. equivalent to app.path (return applications path) ?!??

2. Get application path from Windows Service Application

3. Getting Application Path in C#?

4. Application path - newbie

5. Application path and fopen()

6. Application Path

7. Get calling application path

8. How do I get my applications path?

9. finding application path?

10. How do I get application path name

11. Application Path

12. Application path

 

 
Powered by phpBB® Forum Software