File Location - Please help

This is a discussion on File Location - Please help within the Windows Programming forums, part of the Platform Specific Boards category; Hello. I am writing a program in MFC, and there are a few files included as dependencies in the installation. ...

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    18

    File Location - Please help

    Hello.

    I am writing a program in MFC, and there are a few files included as dependencies in the installation. These files will be placed in the application folder on the target machine. The user can install this program anywhere they want on their computer. Inside the program, a path is needed to open up these default files, but if the user can install anywhere, how do I know the path? I have heard there is a function that gets the installation path of the program. I have searched for quite awhile, and I do not think i am getting close because I dont know how to phrase what Im looking for. If you have any suggestions, please let me know.

    Thanks,
    Khelder

  2. #2
    Registered User
    Join Date
    Dec 2003
    Posts
    18

    Naturally

    It seems posting on message boards is good look. 5 hours of searching...nada...post on message board..run across fix 5 minutes later. In case anyone was wondering, this gives the path to the location of the installation:

    CString Path(*__argv);

    Thanks anyways,

    Khelder

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    You can also use the GetModuleFileName() API function to return the path and name of the current module.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File being filled with NULLs
    By Tigers! in forum Windows Programming
    Replies: 2
    Last Post: 06-30-2009, 06:28 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 05:27 PM
  3. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-22-2008, 12:19 AM
  4. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21