-
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:
Code:
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
cout << argv[1] << endl;
system("pause");
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,
Guitarist809
-
You're CWinApp derived object has an inherited m_lpCmdLine member.
Code:
AfxGetApp()->m_lbCmdLine
You can also use the Win32API call GetCommandLine(). Unlike argc/argv, the entire command line is in one string.
gg
-
or use ParseCommandLine() to access the CCommandLineInfo object.