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

Thread: Application open at window startup but showing the wrong path

  1. #1
    Join Date
    Mar 2010
    Posts
    74

    Application open at window startup but showing the wrong path

    Hi all ,
    My application is installed properly and open on start up.When I checked the current opened application path by using the GetCurrentDirectory() Method it showing "C:\Documents and Settings\Administrator" but the original application had stored at "C:\program files\App\App.exe"

    Because of this, start up application does find dynamic Dll file which had been stored at "C:\program files\App\App.dll" and my application get crashed because it doesn't find tha App.dll at correct path.

    Can anybody tell me when application open at startup why it's showing the path "C:\Documents and Settings\Administrator" instead of "C:\program files\App".

    And what could be the desired solutions for this problem.

    Thanks in advance..



    thanks,
    rohit

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,928

    Re: Application open at window startup but showing the wrong path

    Don't use GetCurrentDirectory.
    Use GetModuleFileName to obtain the full path and file name of your exe and zhen extract to path part from it.
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2010
    Posts
    74

    Re: Application open at window startup but showing the wrong path

    thanks for reply, it worked.

  4. #4
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: Application open at window startup but showing the wrong path

    You could have found the answer by looking at our FAQ:


Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)