# OLECMDID

Specifies which command to execute. (The commands in this enumeration are the standard commands defined by Office 95.) A single value from this enumeration is passed in the nCmdID argument of IOleCommandTarget::Exec.

    typedef enum
    {
        OLECMDID_OPEN            =  1,
        OLECMDID_NEW             =  2,
        OLECMDID_SAVE            =  3,
        OLECMDID_SAVEAS          =  4,
        OLECMDID_SAVECOPYAS      =  5,
        OLECMDID_PRINT           =  6,
        OLECMDID_PRINTPREVIEW    =  7,
        OLECMDID_PAGESETUP       =  8,
        OLECMDID_SPELL           =  9,
        OLECMDID_PROPERTIES      = 10,
        OLECMDID_CUT             = 11,
        OLECMDID_COPY            = 12,
        OLECMDID_PASTE           = 13,
        OLECMDID_PASTESPECIAL    = 14,
        OLECMDID_UNDO            = 15,
        OLECMDID_REDO            = 16,
        OLECMDID_SELECTALL       = 17,
        OLECMDID_CLEARSELECTION  = 18,
        OLECMDID_ZOOM            = 19,
        OLECMDID_GETZOOMRANGE    = 20
    } OLECMDID;

Elements

OLECMDID_OPEN
  File Open
OLECMDID_NEW
  File New
OLECMDID_SAVE
  File Save
OLECMDID_SAVEAS
  File Save As
OLECMDID_SAVECOPYAS
  File Save Copy As
OLECMDID_PRINT
  File Print
OLECMDID_PRINTPREVIEW
  File Print Preview
OLECMDID_PAGESETUP
  File Page Setup
OLECMDID_SPELL
  Tools Spelling
OLECMDID_PROPERTIES
  File Properties
OLECMDID_CUT
  Edit Cut
OLECMDID_COPY
  Edit Copy
OLECMDID_PASTE
  Edit Paste
OLECMDID_PASTESPECIAL
  Edit Paste Special
OLECMDID_UNDO
  Edit Undo
OLECMDID_REDO
  Edit Redo
OLECMDID_SELECTALL
  Edit Select All
OLECMDID_CLEARSELECTION
  Edit Clear
OLECMDID_ZOOM
  View Zoom (see below for details)
OLECMDID_GETZOOMRANGE
  Retrieves zoom range applicable to View Zoom (see below for details)

Remarks

In OLE Documents technology, an object that is being edited in-place disables the Zoom control on its toolbar and the Zoom command on its View.menu because, logically, the Zoom command applies to the container document , not to the object. Now, in OLE Document Objects technology, the OLECMDID_ZOOM and OLECMDID_GETZOOMRANGE commands provide a document object with a means of notifying the container’s frame object of the zoom range that it should display in its user interface.(the container frame is the client-side object that implements IOleInPlaceFrame and, optionally, IOleCommandTarget).

The OLECMDID_ZOOM command takes one LONG argument as input and returns one LONG argument on output. This command is used for three purposes:

- To query the current zoom value that the caller passes to OLECMDEXECOPT_DONTPROMPTUSER as the execute option in nCmdExecOpt and NULL for pvIn. The object returns the current zoom value in pvaOut. When the object goes UI active, it retrieves the current zoom value from the container’s frame object using this same mechanism and updates its zoom control with the returned value.

- To display the Zoom dialog box the caller passes OLECMDEXECOPT_PROMPTUSER in nCmdExecOpt. The caller can optionally pass the initial value for the dialog box through pvaIn, otherwise pvaIn must be NULL. If the user presses CANCEL, the object returns OLECMDERR_E_CANCELED; if the user presses OK, then the object returns the user selected value in pvaOut. When user selects the View.Zoom menu item, the object calls container’s frame object in the same manner. The container then zooms the document to the user selected value, and the object updates its Zoom control with that value.

- To set a Zoom value the caller passes OLECMDEXECOPT_DONTPROMPTUSER in nCmdExecOpt and passes the zoom value to apply through pvaIn. The object validates and normalizes the new value and returns the validated value in pvaOut. When the user selects a new zoom value (using the Zoom control on the toolbar for instance), the object calls the container’s frame object in this manner. The container zooms the document to the normalized value and the object updates the Zoom control with that value.

The OLECMDID_GETZOOMRANGE command is used to determine the range of valid zoom values from an object that implements IOleCommandTarget. The caller passes MSOCMDEXECOPT_DONTPROMPTUSER in nCmdExecOpt and NULL for pvaIn. The object returns its zoom range as a DWORD in pvaOut where the HIWORD contains the maximum zoom value and the LOWORD contains the minimum zoom value. Typically this command is used when the user drops down the Zoom control on the toolbar of the UI-active object. The applications and objects that support this command are required to support all the integral zoom values that are within the (min,max) pair they return.

See Also

IOleCommandTarget, IOleCommandTarget::Exec, IOleInPlaceFrame