Using multiple .ini files with one .exe - Programmer

This is a discussion on Using multiple .ini files with one .exe - Programmer ; Hi, Is it possible? What I'm thinking of doing is 1. Create Shortcuts to the .exe and create .ini file for each shortcut using the exact same name as the shortcut 2. When the application runs, it gets the name ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: Using multiple .ini files with one .exe

  1. Using multiple .ini files with one .exe

    Hi,
    Is it possible? What I'm thinking of doing is

    1. Create Shortcuts to the .exe and create .ini file for
    each shortcut using the exact same name as the shortcut
    2. When the application runs, it gets the name of the shortcut that
    launched the application. Then it knows which .ini file it should
    be looking for.

    My problem is that I do not know how to get the name of the shortcut
    that launched the application. I know GetModuleFileName(..), but that
    returns the name the .exe. What I need is the name of the shortcut. Any
    thoughts?

    Thanks.
    Andy



  2. Re: Using multiple .ini files with one .exe


    Andy Chang wrote:
    > Hi,
    > Is it possible? What I'm thinking of doing is
    >
    > 1. Create Shortcuts to the .exe and create .ini file for
    > each shortcut using the exact same name as the shortcut
    > 2. When the application runs, it gets the name of the shortcut that
    > launched the application. Then it knows which .ini file it should
    > be looking for.
    >
    > My problem is that I do not know how to get the name of the shortcut
    > that launched the application. I know GetModuleFileName(..), but that
    > returns the name the .exe. What I need is the name of the shortcut. Any
    > thoughts?
    >
    > Thanks.
    > Andy


    You could pass the ini path in as a command line argument. Then just
    make the shortcuts pass in different arguments.

    Hugh


  3. Re: Using multiple .ini files with one .exe

    wrote in message
    news:1118044676.619951.84540@g43g2000cwa.googlegro ups.com...
    >
    >
    > You could pass the ini path in as a command line argument. Then just
    > make the shortcuts pass in different arguments.
    >
    > Hugh
    >


    Nice solution. Thanks. Is __argv safe to use in MFC?

    Andy



  4. Re: Using multiple .ini files with one .exe

    Andy Chang wrote:
    > wrote in message
    > news:1118044676.619951.84540@g43g2000cwa.googlegro ups.com...
    > >
    > >
    > > You could pass the ini path in as a command line argument. Then just
    > > make the shortcuts pass in different arguments.
    > >
    > > Hugh
    > >

    >
    > Nice solution. Thanks. Is __argv safe to use in MFC?
    >
    > Andy


    __argv is for console applications - if you have a Windows MFC
    application then one way is to use the m_lpCmdLine member of your
    CWinApp derived app class. This contains a null terminated string which
    in your case should just contain the path to the ini file.

    Regards,

    Hugh


  5. Re: Using multiple .ini files with one .exe

    wrote in message
    news:1118130506.706854.218910@o13g2000cwo.googlegr oups.com...
    > Andy Chang wrote:
    > > wrote in message
    > > news:1118044676.619951.84540@g43g2000cwa.googlegro ups.com...
    > > >
    > > >
    > > > You could pass the ini path in as a command line argument. Then just
    > > > make the shortcuts pass in different arguments.
    > > >
    > > > Hugh
    > > >

    > >
    > > Nice solution. Thanks. Is __argv safe to use in MFC?
    > >
    > > Andy

    >
    > __argv is for console applications - if you have a Windows MFC
    > application then one way is to use the m_lpCmdLine member of your
    > CWinApp derived app class. This contains a null terminated string which
    > in your case should just contain the path to the ini file.
    >


    Watch out for file path components with embedded spaces.

    Norm


  6. Re: Using multiple .ini files with one .exe

    On 6/4/2005 01:00, Andy Chang wrote:
    > Hi,
    > Is it possible?


    Why not just use commandline arguments?

    ~Jason

    --

  7. Re: Using multiple .ini files with one .exe

    With MFC, you don't have a main() (or WinMain()). It's buried in the
    MFCframework.

    --
    -------------------------------------------------------------------------
    Free software - Baxter Codeworks www.baxcode.com
    -------------------------------------------------------------------------


    "Jason Gurtz" wrote in message
    news:11abqv3kf5q726f@corp.supernews.com...
    > On 6/4/2005 01:00, Andy Chang wrote:
    > > Hi,
    > > Is it possible?

    >
    > Why not just use commandline arguments?
    >
    > ~Jason
    >
    > --




  8. Re: Using multiple .ini files with one .exe

    Baxter wrote:

    > With MFC, you don't have a main() (or WinMain()). It's buried in the
    > MFCframework.


    It is still perfectly possible to use the variables __argc and __argv.
    Just #include .

    --
    Olof Lagerkvist
    ICQ: 724451
    Web: http://here.is/olof


  9. Re: Using multiple .ini files with one .exe


    "Norm Dresner" wrote in message
    news:Wwhpe.909089$w62.538899@bgtnsc05-news.ops.worldnet.att.net...
    >
    > Watch out for file path components with embedded spaces.
    >
    > Norm
    >


    Which can be easily solved by enclosing the command line with quotes
    such as
    prog.exe "command line"

    Andy



+ Reply to Thread