CSnapInItemImpl helps to implement a snap-in node object, while CSnapInPropertyPageImpl implements the snap-in property page object.
In this article, we will learn about the class CSnapInPropertyPageImpl, its syntax, constructor, methods, and data members.
Let’s get started.
CSnapInPropertyPageImpl Class
CSnapInPropertyPageImpl class provides methods for implementing the snap-in property page object.
It's important to note that you can't use this class and its objects in applications executing in Windows Runtime.
You must include the header file atlsnap.h to use this class.
Syntax
CSnapInPropertyPageImpl : public CDialogImplBase
Remarks
The CSnapInPropertyPageImpl class provides a basic implementation for a snap-in property page object. It implements the different interfaces and map types of the snap-in property page.
Members
CSnapInPropertyPageImpl class consists of public constructors, public methods, and public data members.
See the table below, which summarizes all the members and their descriptions.
Public Constructors
Name
Description
CSnapInPropertyPageImpl::CSnapInPropertyPageImpl
It is the constructor.
Public Methods
Name
Description
CSnapInPropertyPageImpl::CancelToClose
It changes the status of the Cancel button and the OK button.
CSnapInPropertyPageImpl::Create
It initializes a newly created CSnapInPropertyPageImpl object.
CSnapInPropertyPageImpl::OnApply
The framework calls this function when the user clicks on the Apply Now button while using a wizard-type property sheet.
CSnapInPropertyPageImpl::OnHelp
The framework calls this function when the user clicks the Help button while using a wizard-type property sheet.
CSnapInPropertyPageImpl::OnKillActive
The framework calls this function when the current page is no longer active.
CSnapInPropertyPageImpl::OnQueryCancel
The framework calls this function when the user clicks the Cancel button and cancel has not taken place.
CSnapInPropertyPageImpl::OnReset
The framework calls this function when the user clicks the Reset button while using a wizard-type property sheet.
CSnapInPropertyPageImpl::OnSetActive
The framework calls this function when the current page becomes active.
CSnapInPropertyPageImpl::OnWizardBack
The framework calls this function when the user clicks the Back button while using a wizard-type property sheet.
CSnapInPropertyPageImpl::OnWizardFinish
The framework calls this function when the user clicks the Finish button while using a wizard-type property sheet.
CSnapInPropertyPageImpl::OnWizardNext
The framework calls this function when the user clicks the Next button while using a wizard-type property sheet.
CSnapInPropertyPageImpl::QuerySiblings
It forwards the current message to all pages of the property sheet.
CSnapInPropertyPageImpl::SetModified
It activates or deactivates the Apply Now button.
Public Data Members
Name
Description
CSnapInPropertyPageImpl::m_psp
The CSnapInPropertyPageImpl object uses
the Windows PROPSHEETPAGE structure.
Let’s see all the class members in detail in the upcoming sections.
Public Constructors
CSnapInPropertyPageImpl::CSnapInPropertyPageImpl
It is the constructor invoked every time a new object is created.
lpszTitle It stores the title of the property page.
Remarks
You need to call the method CSnapInPropertyPageImpl::Create to initialize the underlying structure.
Public Methods
In this section, we will see the various public methods in the CSnapInPropertyPageImpl, their syntax, and their functionalities.
CSnapInPropertyPageImpl::CancelToClose
You can call CSnapInPropertyPageImpl::CancelToClose after you have an unrecoverable made to the data in a page of a modal property sheet.
Syntax
void CancelToClose();
Remarks
This function changes the OK button to close and disables the Cancel button, which alerts the user that the change is permanent and you can't revert it. The CancelToClose() function does not modify the modeless property sheet since the modeless property sheet does not have a Cancel button by default.
CSnapInPropertyPageImpl::Create
The function CSnapInPropertyPageImpl::Create initializes the underlying structure of the property page.
Syntax
HPROPSHEETPAGE Create();
Return Value
It returns the handle to a PROPSHEETPAGE structure which contains the attributes of the newly created property sheet.
CSnapInPropertyPageImpl::OnApply
This function is called when you click the OK or Apply Now button.
Syntax
BOOL OnApply();
Return Value
If the changes are accepted, it returns a nonzero value else, 0.
Remarks
You can activate the Apply Now button by calling the SetModified function with its parameter set to TRUE before the framework calls the OnApply function.
You can also override this function to specify your program's action when the user clicks the Apply Now button. The function must return TRUE to accept the changes; else, it should return FALSE.
The default implementation of OnApply returns TRUE.
CSnapInPropertyPageImpl::OnHelp
The framework calls this function when the user clicks the Help button for the property page.
Syntax
void OnHelp();
Remarks
You can override this function for displaying help for the property page.
CSnapInPropertyPageImpl::OnKillActive
The function CSnapInPropertyPageImpl::OnKillActive Syntax is called when the page is no longer active.
Returns a nonzero value if changes are accepted else 0.
Remarks
You can perform special data validation tasks by overriding this function.
CSnapInPropertyPageImpl::OnQueryCancel
The function CSnapInPropertyPageImpl::OnQueryCancel is called when the user clicks the Cancel button and before the cancel action has taken place.
Syntax
BOOL OnQueryCancel();
Return Value
Returns a nonzero value to allow the cancel operation else 0.
Remarks
You can override this function to perform a specific action when the user clicks the cancel button. The default implementation of OnQueryCancel returns TRUE.
CSnapInPropertyPageImpl::OnReset
The function CSnapInPropertyPageImpl::OnReset gets called when the user clicks the Cancel button.
Syntax
void OnReset();
Remarks
It discards all the changes to all property pages made earlier by the user by clicking the Apply Now button and the property sheet retains focus.
You can override this function to perform a specific action when the user clicks the cancel button.
CSnapInPropertyPageImpl::OnSetActive
The console calls the function CSnapInPropertyPageImpl::OnSetActive when the page is chosen by the user and becomes the active page.
Syntax
BOOL OnSetActive();
Return Value
Returns a nonzero value if the page was successfully set active else 0.
Remarks
You can override this function to perform a specific action when the page is activated. The default implementation returns TRUE.
CSnapInPropertyPageImpl::OnWizardBack
The function CSnapInPropertyPageImpl::OnWizardBack gets called when the user clicks the Back button in a wizard.
Syntax
BOOL OnWizardBack();
Return Value
It returns 0 to automatically advance to the previous page and -1 to prevent the page from changing.
Remarks
You can override this function to perform a specific action that the user must take upon clicking the Back button.
CSnapInPropertyPageImpl::OnWizardFinish
The function CSnapInPropertyPageImpl::OnWizardFinish is called upon clicking the Finish button in the wizard.
Syntax
BOOL OnWizardFinish();
Return Value
It returns a non-zero value when the property sheet gets destroyed when the wizard finishes else 0.
Remarks
You can override this function to perform a specific action that the user must take upon clicking the Finish button.
CSnapInPropertyPageImpl::OnWizardNext
The function CSnapInPropertyPageImpl::OnWizardNext gets called upon clicking the Next button in the wizard.
Syntax
BOOL OnWizardNext();
Return Value
It returns 0 to advance automatically to the next page and -1 to prevent the page from changing.
It returns the identifier of the dialog box which you want to get displayed instead of the next page.
Remarks
You can override this function to perform a specific action that the user must take upon clicking the Next button.
CSnapInPropertyPageImpl::QuerySiblings
The function CSnapInPropertyPageImpl::QuerySiblings is called to forward messages to each page in the property sheet.
wParam It stores additional message-dependent information.
lParam It stores additional message-dependent information.
Return Value
It returns 0 if the message should not get forwarded to the next property page or else 0.
CSnapInPropertyPageImpl::SetModified
The function CSnapInPropertyPageImpl::SetModified is called to enable or disable the Apply Now button on the basis of whether the settings in the property page should be applied to the appropriate external object.
Syntax
void SetModified(BOOL bChanged = TRUE);
Parameters
bChanged It stores TRUE if property page settings are modified, else FALSE to indicate that the property page settings have been applied.
Remarks
The Apply Now button will always be enabled when SetModified( TRUE ) is called for one of the pages else it will be disabled when SetModified( FALSE ) is called for one of the pages, but only if none of the other pages is "dirty."
Public Data Members
In this section, we will see the public data members present in the class CSnapInPropertyPageImpl.
CSnapInPropertyPageImpl::m_psp
It refers to the structure whose members store the characteristics of PROPSHEETPAGE.
Syntax
PROPSHEETPAGE m_psp;
Remarks
You can use this structure for initializing the appearance of a property page once constructed.
Inheritance Hierarchy
The class CSnapInPropertyPageImpl inherits the class CDialogImplBase.
Frequently Asked Questions
What is MMC?
MMC stands for Microsoft Management Console. It offers a common framework for running various snap-ins, which allows the management of several services through a single interface.
What is an MMC event viewer?
An MMC Event Viewer is a Microsoft Management Console (MMC) snap-in that enables us to browse and manage event logs.
What is COM?
COM stands for Component Object Model, which is a platform-independent and object-oriented system that enables us to create binary software components that can interact.
Conclusion
In this article, we learned about the MMC snap-in class CSnapInPropertyPageImpl, its syntax, constructor, methods, and data members.
We hope this blog has helped you enhance your knowledge of the MMC snap-in class CSnapInPropertyPageImpl.
Check out these useful blogs on windows support classes: