共用方式為


CCommandLineInfo::m_nShellCommand

Indicates the shell command for this instance of the application.

m_nShellCommand;

Remarks

The type for this data member is the following enumerated type, which is defined in the CCommandLineInfo class.

enum{

FileNew,

FileOpen,

FilePrint,

FilePrintTo,

FileDDE,

AppRegister,

AppUnregister,

RestartByRestartManager,

FileNothing = -1

};

For a brief description of these values, see the following list.

  • CCommandLineInfo::FileNew   Indicates that no file name was found on the command line.

  • CCommandLineInfo::FileOpen   Indicates that a file name was found on the command line and that none of the following flags were found on the command line: /p, /pt, /dde.

  • CCommandLineInfo::FilePrint   Indicates that the /p flag was found on the command line.

  • CCommandLineInfo::FilePrintTo   Indicates that the /pt flag was found on the command line.

  • CCommandLineInfo::FileDDE   Indicates that the /dde flag was found on the command line.

  • CCommandLineInfo::AppRegister   Indicates that the /Register or /Regserver flag was found on the command line and the application was asked to register.

  • CCommandLineInfo::AppUnregister   Indicates that the /Unregister or /Unregserver application was asked to unregister.

  • CCommandLineInfo::RestartByRestartManager   Indicates that the application was restarted by the restart manager.

  • CCommandLineInfo::FileNothing   Turns off the display of a new MDI child window on startup. By design, Application Wizard-generated MDI applications display a new child window on startup. To turn off this feature, an application can use CCommandLineInfo::FileNothing as the shell command when it calls ProcessShellCommand. ProcessShellCommand is called by the InitInstance( ) of all CWinApp derived classes.

Example

// From CMyWinApp::InitInstance 

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// DON'T display a new MDI child window during startup!!!
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;

// Dispatch commands specified on the command line 
if (!ProcessShellCommand(cmdInfo))
   return FALSE;

Requirements

Header: afxwin.h

See Also

Reference

CCommandLineInfo Class

Hierarchy Chart

CCommandLineInfo::m_strFileName

CCommandLineInfo::m_strPrinterName

CCommandLineInfo::m_strDriverName

CCommandLineInfo::m_strPortName

CWinApp::ProcessShellCommand