Share via


CCommandLineInfo::ParseParam

virtual void ParseParam( LPCTSTR lpszParam**, BOOL** bFlag**, BOOL** bLast );

Parameters

lpszParam

The parameter or flag.

bFlag

Indicates whether lpszParam is a parameter or a flag.

bLast

Indicates if this is the last parameter or flag on the command line.

Remarks

The framework calls this function to parse/interpret individual parameters from the command line. CWinApp::ParseCommandLine calls ParseParam once for each parameter or flag on the command line, passing the argument to lpszParam. If the first character of the parameter is a ‘-’ or a ‘/’, then it is removed and bFlag is set to TRUE. When parsing the final parameter, bLast is set to TRUE.

The default implementation of this function recognizes the following flags: /p, /pt, /dde, /Automation, and /Embedding, as shown in the following table:

Command-line argument Command executed
app New file.
app filename Open file.
app/p filename Print file to default printer.
app/pt filename printer driver port Print file to the specified printer.
app/dde Start up and await DDE command.
app/Automation Start up as an OLE automation server.
app/Embedding Start up to edit an embedded OLE item.

This information is stored in m_bRunAutomated, m_bRunEmbedded, and m_nShellCommand. Flags are marked by either a forward-slash ‘/’ or hyphen ‘-’.

The default implementation puts the first non-flag parameter into m_strFileName. In the case of the /pt flag, the default implementation puts the second, third, and fourth non-flag parameters into m_strPrinterName, m_strDriverName, and m_strPortName, respectively.

The default implementation also sets m_bShowSplash to TRUE only in the case of a new file. In the case of a new file, the user has taken action involving the application itself. In any other case, including opening existing files using the shell, the user action involves the file directly. In a document-centric standpoint, the splash screen does not need to announce the application starting up.

Override this function in your derived class to handle other flag and parameter values.

CCommandLineInfo OverviewClass MembersHierarchy Chart

See Also   CWinApp::ParseCommandLine