共用方式為


CWinApp::m_lpCmdLine

對應於視窗的 lpCmdLine 傳遞參數至 WinMain

LPTSTR m_lpCmdLine;

備註

為應用程式指定命令列的 NULL 結尾字串的點。 當應用程式啟動時,請使用 m_lpCmdLine 存取任何命令列引數的使用者輸入。 m_lpCmdLine 是型別 LPTSTR的公用變數。

範例

if (m_lpCmdLine[0] == _T('\0'))
{
   // Create a new (empty) document.
   OnFileNew();
}
else
{
   // Open a file passed as the first command line parameter.
   OpenDocumentFile(m_lpCmdLine);
}

需求

Header: afxwin.h

請參閱

參考

CWinApp 類別

階層架構圖