Share via


CWinApp::ProcessShellCommand

此成員函式以 InitInstance 呼叫接受 CCommandLineInfo 物件傳遞的參數會識別 rCmdInfo,並執行這個所表示的動作。

BOOL ProcessShellCommand(
   CCommandLineInfo& rCmdInfo 
);

參數

傳回值

如果不是零, Shell 命令成功處理。 如果為 0,從 InitInstance的傳回

備註

使用應用程式精靈,當您開始新的項目, MFC 應用程式精靈會建立 CCommandLineInfo的本機執行個體,然後呼叫 ProcessShellCommandParseCommandLineInitInstance 成員函式。 命令列遵守底下所描述的路由:

  1. 在建立 InitInstance之後, CCommandLineInfo 物件傳遞至 ParseCommandLine

  2. ParseCommandLine 重複則需要 CCommandLineInfo::ParseParam 一次,每一個參數。

  3. ParseParam 填滿 CCommandLineInfo 物件,然後將它傳遞至 ProcessShellCommand

  4. ProcessShellCommand 處理命令列引數和旗標。

CCommandLineInfo 之資料成員的物件,可識別由 CCommandLineInfo::m_nShellCommand,以下列舉型別,在 CCommandLineInfo 類別中定義。

enum {

FileNew,

FileOpen,

FilePrint,

FilePrintTo,

FileDDE,

};

如需這些值的每一個的簡短說明,請參閱 CCommandLineInfo::m_nShellCommand

需求

Header: afxwin.h

請參閱

參考

CWinApp 類別

階層架構圖

CWinApp::ParseCommandLine

CCommandLineInfo 類別

CCommandLineInfo::ParseParam

CCommandLineInfo::m_nShellCommand