Partager via


CWinApp::ProcessShellCommand

This member function is called by InitInstance to accept the parameters passed from the CCommandLineInfo object identified by rCmdInfo, and perform the indicated action.

BOOL ProcessShellCommand(
   CCommandLineInfo& rCmdInfo 
);

Parameters

Return Value

Nonzero if the shell command is processed successfully. If 0, return FALSE from InitInstance.

Remarks

When you start a new MFC project using the Application Wizard, the Application Wizard will create a local instance of CCommandLineInfo, and then call ProcessShellCommand and ParseCommandLine in the InitInstance member function. A command line follows the route described below:

  1. After being created in InitInstance, the CCommandLineInfo object is passed to ParseCommandLine.

  2. ParseCommandLine then calls CCommandLineInfo::ParseParam repeatedly, once for each parameter.

  3. ParseParam fills the CCommandLineInfo object, which is then passed to ProcessShellCommand.

  4. ProcessShellCommand handles the command-line arguments and flags.

The data members of the CCommandLineInfo object, identified by CCommandLineInfo::m_nShellCommand, are of the following enumerated type, which is defined within the CCommandLineInfo class.

enum {

FileNew,

FileOpen,

FilePrint,

FilePrintTo,

FileDDE,

};

For a brief description of each of these values, see CCommandLineInfo::m_nShellCommand.

Requirements

Header: afxwin.h

See Also

Reference

CWinApp Class

Hierarchy Chart

CWinApp::ParseCommandLine

CCommandLineInfo Class

CCommandLineInfo::ParseParam

CCommandLineInfo::m_nShellCommand

Other Resources

CWinApp Members