方法一:
CString sCmdline = ::GetCommandLine(); AfxMessageBox(sCmdline); 將獲取到 "C:\test\app.exe -1 -2 "
方法二:
for (int i = 0; i < __argc; i++) { __argv[i]; AfxMessageBox(__argv[i]); } 將依次得到"C:\test\app.exe","-1", "-2"
方法三:
CString sCmdline = AfxGetApp()->m_lpCmdLine; 將獲取到 "-1 -2 ",AfxGetApp()->m_lpCmdLine 只包含參數。