Here's how I do it in MFC apps:
int option1_value;
BOOL option2_value;
if (m_lpCmdLine[0] != '\0')
{
// parse each command line token
char seps[] = " "; // spaces
char *token;
char *p;
token = strtok(m_lpCmdLine, seps); // establish first token
while (token != NULL)
{
// check the option
do // block to break out of
{
if ((p = strstr(strupr(token),"/OPTION1:")) != NULL)
{
sscanf(p + 9,"%d", &option1_value);
break;
}
if ((p = strstr(strupr(token),"/OPTION2")) != NULL)
{
option2_value = TRUE;
break;
}
}
while(0);
token = strtok(NULL, seps); // get next token
}
} // end command line not empty