Hi
The brave guys at Microsoft have designed something to parse command line the easy way ( hmmmm...)
First set up a class as followed:
class CDemoCmdLineInfo : public CCommandLineInfo
{
// Constrcutor
public:
CDemoCmdLineInfo();
// Overrides
// Parse Parameters of Command Line
virtual void ParseParam( const char* pszParam, BOOL bFlag, BOOL Last);
};
CDemoCmdLineInfo::CDemoCmdLineInfo()
{
}
void CDemoCmdLineInfo:

arseParam( const char* pszParam,
BOOL bFlag, BOOL Last)
{
CString strParam = pszParam;
CString str;
str.Format( "Parameter ::%s:: Last One ? %s \n", pszParam, Last ? "TRUE" :"FALSE"

;
::OutputDebugString( str);
CCommandLineInfo:

arseParam( pszParam, bFlag, Last);
}
Add the following line in OnInitInstance:
// Parse Parameters of Command Line
CDemoCmdLineInfo CmdLine;
ParseCommandLine( CmdLine);
Just before the line
int nResponse = dlg.DoModal();
To test it, modify the settings 'Program Arguments' in the 'Debug Tab' to something like this;
-Mode

emo -Line:1234 -File:c:\demo
If you run the program, you should have the following lines in the 'Debug' tag of the Output window
Parameter ::Mode

emo:: Last One ? FALSE
Parameter ::Line:1234:: Last One ? FALSE
Parameter ::File:c:\demo:: Last One ? TRUE
Of course, now you'll have to dig a few in the doc. and handle the possible erroneous parameters entered by the user. At least, you already got them.
Note that -Mode:, -Line:, .. are not required.
HTH
Thierry
EMail: Thierry.Marneffe@swing.be