Help on Command Line Parameters
-
Hi, In a Win32 Application I would like to check if command line parameters /b /a is provided. The Messagebox show me the parametters like /b /a but the if condition do not met it alwasy the else statment that apply. if ("/b" == szCmdLine || szCmdLine == "/a") { MessageBox (NULL, szCmdLine,"met",0); } else { MessageBox (NULL, szCmdLine,"Not met",0); } I did also chcked "//b" == szCmdLine. What I am missing? Regards.
-
Hi, In a Win32 Application I would like to check if command line parameters /b /a is provided. The Messagebox show me the parametters like /b /a but the if condition do not met it alwasy the else statment that apply. if ("/b" == szCmdLine || szCmdLine == "/a") { MessageBox (NULL, szCmdLine,"met",0); } else { MessageBox (NULL, szCmdLine,"Not met",0); } I did also chcked "//b" == szCmdLine. What I am missing? Regards.
if szCmdLine contains other parameters besides /a or /b, you will need to do this.
if (szCmdLine.Find("/b") >= 0 || szCmdLine.Find("/a") >= 0) { MessageBox (NULL, szCmdLine,"met",0); } else { MessageBox (NULL, szCmdLine,"Not met",0); }
-
Hi, In a Win32 Application I would like to check if command line parameters /b /a is provided. The Messagebox show me the parametters like /b /a but the if condition do not met it alwasy the else statment that apply. if ("/b" == szCmdLine || szCmdLine == "/a") { MessageBox (NULL, szCmdLine,"met",0); } else { MessageBox (NULL, szCmdLine,"Not met",0); } I did also chcked "//b" == szCmdLine. What I am missing? Regards.
Use Paul DiLascia's
CCommandLineInfoEx
class for this.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow