Edit

Share via


COleChangeSourceDialog Class

Used for the OLE Change Source dialog box.

Syntax

class COleChangeSourceDialog : public COleDialog

Members

Public Constructors

Name Description
COleChangeSourceDialog::COleChangeSourceDialog Constructs a COleChangeSourceDialog object.

Public Methods

Name Description
COleChangeSourceDialog::DoModal Displays the OLE Change Source dialog box.
COleChangeSourceDialog::GetDisplayName Gets the complete source display name.
COleChangeSourceDialog::GetFileName Gets the filename from the source name.
COleChangeSourceDialog::GetFromPrefix Gets the prefix of the previous source.
COleChangeSourceDialog::GetItemName Gets the item name from the source name.
COleChangeSourceDialog::GetToPrefix Gets the prefix of the new source
COleChangeSourceDialog::IsValidSource Indicates if the source is valid.

Public Data Members

Name Description
COleChangeSourceDialog::m_cs A structure that controls the behavior of the dialog box.

Remarks

Create an object of class COleChangeSourceDialog when you want to call this dialog box. After a COleChangeSourceDialog object has been constructed, you can use the m_cs structure to initialize the values or states of controls in the dialog box. The m_cs structure is of type OLEUICHANGESOURCE. For more information about using this dialog class, see the DoModal member function.

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

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

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CDialog

CCommonDialog

COleDialog

COleChangeSourceDialog

Requirements

Header: afxodlgs.h

COleChangeSourceDialog::COleChangeSourceDialog

This function constructs a COleChangeSourceDialog object.

explicit COleChangeSourceDialog(
    COleClientItem* pItem,
    CWnd* pParentWnd = NULL);

Parameters

pItem
Pointer to the linked COleClientItem whose source is to be updated.

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 will be set to the main application window.

Remarks

To display the dialog box, call the DoModal function.

For more information, see the OLEUICHANGESOURCE structure and OleUIChangeSource function in Windows SDK.

COleChangeSourceDialog::DoModal

Call this function to display the OLE Change Source 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 OleUIChangeSource function in Windows SDK.

Remarks

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

If DoModal returns IDOK, you can call member functions to retrieve user-entered settings or information from the dialog box. The following list names typical query functions:

COleChangeSourceDialog::GetDisplayName

Call this function to retrieve the complete display name for the linked client item.

CString GetDisplayName();

Return Value

The complete source display name (moniker) for the COleClientItem specified in the constructor.

COleChangeSourceDialog::GetFileName

Call this function to retrieve the file moniker portion of the display name for the linked client item.

CString GetFileName();

Return Value

The file moniker portion of the source display name for the COleClientItem specified in the constructor.

Remarks

The file moniker together with the item moniker gives the complete display name.

COleChangeSourceDialog::GetFromPrefix

Call this function to get the previous prefix string for the source.

CString GetFromPrefix();

Return Value

The previous prefix string of the source.

Remarks

Call this function only after DoModal returns IDOK.

This value comes directly from the lpszFrom member of the OLEUICHANGESOURCE structure.

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

COleChangeSourceDialog::GetItemName

Call this function to retrieve the item moniker portion of the display name for the linked client item.

CString GetItemName();

Return Value

The item moniker portion of the source display name for the COleClientItem specified in the constructor.

Remarks

The file moniker together with the item moniker gives the complete display name.

COleChangeSourceDialog::GetToPrefix

Call this function to get the new prefix string for the source.

CString GetToPrefix();

Return Value

The new prefix string of the source.

Remarks

Call this function only after DoModal returns IDOK.

This value comes directly from the lpszTo member of the OLEUICHANGESOURCE structure.

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

COleChangeSourceDialog::m_cs

This data member is a structure of type OLEUICHANGESOURCE.

OLEUICHANGESOURCE m_cs;

Remarks

OLEUICHANGESOURCE is used to control the behavior of the OLE Change Source dialog box. Members of this structure can be modified directly.

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

COleChangeSourceDialog::IsValidSource

Call this function to determine if the new source is valid.

BOOL IsValidSource();

Return Value

Nonzero if the new source is valid, otherwise 0.

Remarks

Call this function only after DoModal returns IDOK.

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

See also

COleDialog Class
Hierarchy Chart
COleDialog Class