แก้ไข

แชร์ผ่าน


COleConvertDialog Class

For more information, see the OLEUICONVERT structure in the Windows SDK.

Syntax

class COleConvertDialog : public COleDialog

Members

Public Constructors

Name Description
COleConvertDialog::COleConvertDialog Constructs a COleConvertDialog object.

Public Methods

Name Description
COleConvertDialog::DoConvert Performs the conversion specified in the dialog box.
COleConvertDialog::DoModal Displays the OLE Change Item dialog box.
COleConvertDialog::GetClassID Gets the CLSID associated with the chosen item.
COleConvertDialog::GetDrawAspect Specifies whether to draw item as an icon.
COleConvertDialog::GetIconicMetafile Gets a handle to the metafile associated with the iconic form of this item.
COleConvertDialog::GetSelectionType Gets the type of selection chosen.

Public Data Members

Name Description
COleConvertDialog::m_cv A structure that controls the behavior of the dialog box.

Remarks

Note

Application Wizard-generated container code uses this class.

For more information about OLE-specific dialog boxes, see the article Dialog Boxes in OLE.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CDialog

CCommonDialog

COleDialog

COleConvertDialog

Requirements

Header: afxodlgs.h

COleConvertDialog::COleConvertDialog

Constructs only a COleConvertDialog object.

explicit COleConvertDialog (
    COleClientItem* pItem,
    DWORD dwFlags = CF_SELECTCONVERTTO,
    CLSID* pClassID = NULL,
    CWnd* pParentWnd = NULL);

Parameters

pItem
Points to the item to be converted or activated.

dwFlags
Creation flag, which contains any number of the following values combined using the bitwise-or operator:

  • CF_SELECTCONVERTTO Specifies that the Convert To radio button will be selected initially when the dialog box is called. This is the default.

  • CF_SELECTACTIVATEAS Specifies that the Activate As radio button will be selected initially when the dialog box is called.

  • CF_SETCONVERTDEFAULT Specifies that the class whose CLSID is specified by the clsidConvertDefault member of the m_cv structure will be used as the default selection in the class list box when the Convert To radio button is selected.

  • CF_SETACTIVATEDEFAULT Specifies that the class whose CLSID is specified by the clsidActivateDefault member of the m_cv structure will be used as the default selection in the class list box when the Activate As radio button is selected.

  • CF_SHOWHELPBUTTON Specifies that the Help button will be displayed when the dialog box is called.

pClassID
Points to the CLSID of the item to be converted or activated. If NULL, the CLSID associated with pItem will be used.

pParentWnd
Points to the parent or owner window object (of type CWnd) to which the dialog object belongs. If it is NULL, the parent window of the dialog box is set to the main application window.

Remarks

To display the dialog box, call the DoModal function.

For more information, see CLSID Key and the OLEUICONVERT structure.

COleConvertDialog::DoConvert

Call this function, after returning successfully from DoModal, either to convert or to activate an object of type COleClientItem.

BOOL DoConvert(COleClientItem* pItem);

Parameters

pItem
Points to the item to be converted or activated. Cannot be NULL.

Return Value

Nonzero if successful; otherwise 0.

Remarks

The item is converted or activated according to the information selected by the user in the Convert dialog box.

COleConvertDialog::DoModal

Call this function to display the OLE Convert dialog box.

virtual INT_PTR DoModal();

Return Value

Completion status for the dialog box. One of the following values:

  • IDOK if the dialog box was successfully displayed.

  • IDCANCEL if the user canceled the dialog box.

  • IDABORT if an error occurred. If IDABORT is returned, call the COleDialog::GetLastError member function to get more information about the type of error that occurred. For a listing of possible errors, see the OleUIConvert function in the Windows SDK.

Remarks

If you want to initialize the various dialog box controls by setting members of the m_cv structure, you should do this before calling DoModal, but after the dialog object is constructed.

If DoModal returns IDOK, you can call other member functions to retrieve the settings or information that was input by the user into the dialog box.

COleConvertDialog::GetClassID

Call this function to get the CLSID associated with the item the user selected in the Convert dialog box.

REFCLSID GetClassID() const;

Return Value

The CLSID associated with the item that was selected in the Convert dialog box.

Remarks

Call this function only after DoModal returns IDOK.

For more information, see CLSID Key in the Windows SDK.

COleConvertDialog::GetDrawAspect

Call this function to determine whether the user chose to display the selected item as an icon.

DVASPECT GetDrawAspect() const;

Return Value

The method needed to render the object.

  • DVASPECT_CONTENT Returned if the Display As Icon check box was not checked.

  • DVASPECT_ICON Returned if the Display As Icon check box was checked.

Remarks

Call this function only after DoModal returns IDOK.

For more information on drawing aspect, see the FORMATETC data structure in the Windows SDK.

COleConvertDialog::GetIconicMetafile

Call this function to get a handle to the metafile that contains the iconic aspect of the selected item.

HGLOBAL GetIconicMetafile() const;

Return Value

The handle to the metafile containing the iconic aspect of the selected item, if the Display As Icon check box was checked when the dialog was dismissed by choosing OK; otherwise NULL.

COleConvertDialog::GetSelectionType

Call this function to determine the type of conversion selected in the Convert dialog box.

UINT GetSelectionType() const;

Return Value

Type of selection made.

Remarks

The return type values are specified by the Selection enumeration type declared in the COleConvertDialog class.

enum Selection {
    noConversion,
    convertItem,
    activateAs
    };

Brief descriptions of these values follow:

  • COleConvertDialog::noConversion Returned if either the dialog box was canceled or the user selected no conversion. If COleConvertDialog::DoModal returned IDOK, it is possible that the user selected a different icon than the one previously selected.

  • COleConvertDialog::convertItem Returned if the Convert To radio button was checked, the user selected a different item to convert to, and DoModal returned IDOK.

  • COleConvertDialog::activateAs Returned if the Activate As radio button was checked, the user selected a different item to activate, and DoModal returned IDOK.

COleConvertDialog::m_cv

Structure of type OLEUICONVERT used to control the behavior of the Convert dialog box.

OLEUICONVERT m_cv;

Remarks

Members of this structure can be modified either directly or through member functions.

For more information, see the OLEUICONVERT structure in the Windows SDK.

See also

COleDialog Class
Hierarchy Chart
COleDialog Class