Table of contents
1.
Introduction
2.
CSnapInPropertyPageImpl Class
2.1.
Syntax
2.2.
Remarks
3.
Members
4.
Public Constructors
4.1.
CSnapInPropertyPageImpl::CSnapInPropertyPageImpl
4.1.1.
Syntax
4.1.2.
Parameters
4.1.3.
Remarks
5.
Public Methods
5.1.
CSnapInPropertyPageImpl::CancelToClose
5.1.1.
Syntax
5.1.2.
Remarks
5.2.
CSnapInPropertyPageImpl::Create
5.2.1.
Syntax
5.2.2.
Return Value
5.3.
CSnapInPropertyPageImpl::OnApply
5.3.1.
Syntax
5.3.2.
Return Value
5.3.3.
Remarks
5.4.
CSnapInPropertyPageImpl::OnHelp
5.4.1.
Syntax
5.4.2.
Remarks
5.5.
CSnapInPropertyPageImpl::OnKillActive
5.5.1.
Syntax
5.5.2.
Return Value
5.5.3.
Remarks
5.6.
CSnapInPropertyPageImpl::OnQueryCancel
5.6.1.
Syntax
5.6.2.
Return Value
5.6.3.
Remarks
5.7.
CSnapInPropertyPageImpl::OnReset
5.7.1.
Syntax
5.7.2.
Remarks
5.8.
CSnapInPropertyPageImpl::OnSetActive
5.8.1.
Syntax
5.8.2.
Return Value
5.8.3.
Remarks
5.9.
CSnapInPropertyPageImpl::OnWizardBack
5.9.1.
Syntax
5.9.2.
Return Value
5.9.3.
Remarks
5.10.
CSnapInPropertyPageImpl::OnWizardFinish
5.10.1.
Syntax
5.10.2.
Return Value
5.10.3.
Remarks
5.11.
CSnapInPropertyPageImpl::OnWizardNext
5.11.1.
Syntax
5.11.2.
Return Value
5.11.3.
Remarks
5.12.
CSnapInPropertyPageImpl::QuerySiblings
5.12.1.
Syntax
5.12.2.
Parameters
5.12.3.
Return Value
5.13.
CSnapInPropertyPageImpl::SetModified
5.13.1.
Syntax
5.13.2.
Parameters
5.13.3.
Remarks
6.
Public Data Members
6.1.
CSnapInPropertyPageImpl::m_psp
6.1.1.
Syntax
6.1.2.
Remarks
7.
Inheritance Hierarchy
8.
Frequently Asked Questions
8.1.
What is MMC?
8.2.
What is an MMC event viewer?
8.3.
What is COM?
9.
Conclusion
Last Updated: Mar 27, 2024
Medium

MMC Snap In Class CSnapInPropertyPageImpl

Author Yukti Kumari
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

The Snap-In classes allow you to develop Microsoft Management Console (MMC) snap-in components. There are two MMC Snap-In classes: 

CSnapInItemImpl helps to implement a snap-in node object, while CSnapInPropertyPageImpl implements the snap-in property page object.

mmc-snap-in-classes

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.

Syntax

CSnapInPropertyPageImpl(LPCTSTR lpszTitle = NULL);

Parameters

  • 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.

Syntax

GetResultPaneInfo (RESULTDATAITEM* pResultDataItem);

Return Value

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.

Syntax

LRESULT QuerySiblings(WPARAM wParam, LPARAM lParam);

Parameters

  • 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:

 

Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. Enroll in our courses and refer to the mock test and problems available, interview puzzles, take a look at the interview experiences, and interview bundle for placement preparations.

Do upvote our blog to help other ninjas grow

Happy Reading!!‍

Live masterclass