CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Get the AppPath

  1. #1
    Join Date
    May 1999
    Location
    Germany
    Posts
    7

    Get the AppPath

    How can I get the full path name of my application at runtime???


  2. #2
    Join Date
    May 1999
    Posts
    42

    Re: Get the AppPath

    See GetModuleFileName() in the docs.


  3. #3
    Join Date
    Apr 1999
    Location
    CA, USA
    Posts
    78

    Re: Get the AppPath

    You can also use GetCommandLine() to get the full path for your app.


  4. #4
    Join Date
    Sep 1999
    Posts
    1

    Re: Get the AppPath

    Hi.
    I use this procedure:

    UINT GetBaseDirectory(LPTSTR lpBuffer, UINT uSize)
    {
    if(lpBuffer==NULL) {ASSERT(0); return 0;}

    DWORD resLen = GetModuleFileName(NULL, lpBuffer, uSize);
    if(resLen==0) {ASSERT(0); return 0;}

    //exclude file name
    do
    resLen--;
    while(lpBuffer[resLen-1]!='\\');
    lpBuffer[resLen] = 0;

    return resLen;
    }

    Best wishes.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured