本文轉(zhuǎn)自:
http://blog.csdn.net/bao_qibiao/article/details/4528860
在MFC程序中,可以用以下幾種方法來獲取命令行參數(shù)。
為方便說明,我們假設(shè)執(zhí)行了命令:C:/test/app.exe -1 -2
方法一
1 ::GetCommandLine ();
2 //將獲取到 "C:/test/app.exe" -1 -2
方法二
1 for (int i=0;i<__argc ;i++)
2 {
3 __argv [i];
4 //將依次得到C:/test/app.exe -1 -2
5 }
方法三
1 AfxGetApp ()->m_lpCmdLine;
2 //將獲取到 -1 -2
posted on 2012-04-12 12:26
王海光 閱讀(634)
評論(0) 編輯 收藏 引用 所屬分類:
MFC