When you add a property page to a project using the Microsoft® Visual C++® user interface, the property page class that manages that property page is a self-contained unit. This means that although all of the code that governs the functionality of the property page is contained in the property page class.
To be displayed by the Win32®-based Pipeline Editor, however, you need to create a link that identifies your property pages class to your component class. At this point in the tutorial, the component class, CMinMaxShipping, has no way of identifying the class in which the property page is implemented.
To provide this identification, you implement the ISpecifyPropertyPages interface in the CMinMaxShipping component class. The ISpecifyPropertyPages interface defines the following method:
ISpecifyPropertyPages::GetPages(CAUUID *pPages)
To implement ISpecifyPropertyPages, you implement the GetPages method by initializing its pPages out-parameter to reference the class ID (CLSID) of the class that implements the component’s property pages. When a user double-clicks the MinMaxShip component in the Win32-based Pipeline Editor, the Pipeline Editor calls QueryInterface on the MinMaxShip component to determine if the component supports ISpecifyPropertyPages. If the component does not, nothing happens. If it does, the Pipeline Editor gets an interface pointer on the component’s ISpecifyPropertyPages implementation, and uses this pointer to call GetPages. If you implement GetPages properly, the Pipeline Editor now has the CLSID of the object that implements the property pages for your component.
In the section, Step Two: Adding an Object, the Pipeline Component Wizard offered you the opportunity to implement the ISpecifyPropertyPages interface. If you opted to implement this interface, the Pipeline Component Wizard added the following stub implementation of GetPages to the MinMaxShipping.h file:
// ISpecifyPropertyPages Methods
//
STDMETHODIMP CMinMaxShipping::GetPages(CAUUID *pPages)
{
if (NULL == pPages)
return E_INVALIDARG;
// TODO: Uncomment out the line below, and add the CLSID of a custom
// Property Page Control
/*
pPages->cElems = 1;
pPages->pElems = (GUID*)CoTaskMemAlloc(1*sizeof(GUID));
if(!pPages->pElems){
pPages->cElems = 0; return E_OUTOFMEMORY;
}
memcpy(pPages->pElems, &CLSID_MinMaxShippingPpg, sizeof(GUID));
return S_OK;
*/
return E_NOTIMPL;
}
To make this method functional, you generally replace the CLSID referenced in the call to memcpy with the CLSID for the object that implements your property pages. You can locate this CLSID in the class definition file for your property page class.
Because CLSID_MinMaxShippingPpg is the correct CLSID for this tutorial, you can remove the comment delimiters from this code, and compile.