Thread: Arguments in MFC

  1. #1
    Registered User
    Join Date
    Mar 2006

    Question Arguments in MFC

    What's up

    I'm trying to figure out how to retrieve arguments in a MFC program.

    In a normal console program you've got:
    #include <iostream>
    using namespace std;
    int main (int argc, char *argv[])
         cout << argv[1] << endl;
         return 0;
    and that would display something passed along with the file when it is about to be executed. Is there a hidden argv/argc in MFC? (I'm trying to pass variables to the program when it starts that could include /hidden or /off or /on or something along those lines..)

    Help will be greatly appreciated,

    Thanks in advance,


  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    You're CWinApp derived object has an inherited m_lpCmdLine member.
    You can also use the Win32API call GetCommandLine(). Unlike argc/argv, the entire command line is in one string.


  3. #3
    train spotter
    Join Date
    Aug 2001
    near a computer
    or use ParseCommandLine() to access the CCommandLineInfo object.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC Controls and Thread Safety :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 12-06-2002, 11:36 AM
  2. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  3. Release MFC Programs & Dynamic MFC DLL :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-18-2002, 06:42 PM
  4. Beginning MFC (Prosise) Part III - Now What? :: C++
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2002, 06:58 PM
  5. MFC is Challenging :: C++
    By kuphryn in forum C++ Programming
    Replies: 8
    Last Post: 02-05-2002, 01:33 AM