CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2011
    Posts
    2

    GetInstDir() function.

    I am using GetInstDir() to access the current directory of execution of my executable file

    When I debugged the code the directory is coming like this one.

    "D:\\SVN_NEW\\NewProject\\SetupScr\\..\\setup files\\setup.exe"

    on execution of function SHFileOperation with this path it results in returning of value 2. Which is error file not found.

    After that I hard code the path to

    "D:\\SVN_NEW\\NewProject\\setup files\\setup.exe"

    Which is working fine.

    Now, the question is \\..\\ Is it giving problem. What should I do to change my directory to second one. As this is working fine and this is what I really need.


    Welcome in case of any more information.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: GetInstDir() function.

    I use GetModuleFileName, and have never had any issues. You may want to give that a try.

    https://msdn.microsoft.com/en-us/lib...=vs.85%29.aspx

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: GetInstDir() function.

    Quote Originally Posted by anmol2701 View Post
    I am using GetInstDir() to access the current directory of execution of my executable file
    ...
    Now, the question is \\..\\ Is it giving problem. What should I do to change my directory to second one. As this is working fine and this is what I really need.
    First of all, I agree with GCDEF.
    As for your "\\..\\" problem - you could use PathCanonicalize function to make your path compatible with SHFileOperation
    Victor Nijegorodov

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