ActiveX Controls: Using Stock Property Pages

OverviewHow Do IFAQSample

This article discusses the stock property pages available for ActiveX controls and how to use them.

For more information on using property pages in an ActiveX control, see the following articles:

MFC provides three stock property pages for use with ActiveX controls: CLSID_CColorPropPage, CLSID_CFontPropPage, and CLSID_CPicturePropPage. These pages display a user interface for stock color, font, and picture properties, respectively.

To incorporate these property pages into a control, add their IDs to the code that initializes the control’s array of property page IDs. In the following example, this code, located in the control implementation file (.CPP), initializes the array to contain all three stock property pages and the default property page (named CMyPropPage in this example):

BEGIN_PROPPAGEIDS( CSampleCtrl, 4 )
    PROPPAGEID( CMyPropPage::guid )
    PROPPAGEID( CLSID_CFontPropPage )
    PROPPAGEID( CLSID_CColorPropPage )
    PROPPAGEID( CLSID_CPicturePropPage )
END_PROPPAGEIDS(CSampleCtrl)

Note that the count of property pages, in the BEGIN_PROPPAGEIDS macro, is 4. This represents the number of property pages supported by the ActiveX control.

After these modifications have been made, rebuild your project. Your control now has property pages for the font, picture, and color properties.

Note   If the control stock property pages cannot be accessed, it may be because the MFC DLL (MFCx0.DLL) has not been properly registered with the current operating system. This usually results from installing Visual C++ under an operating system different from the one currently running.

Tip   If your stock property pages are not visible (see Note above), register the DLL by running RegSvr32.exe from the command line with the path name to the DLL. For example, RegSvr32 C:\Windows\System\MFCx0.dll, for Windows and RegSvr32 C:\NT\System32\MFCx0.dll, for NT.

See Also    ActiveX Controls: Adding Stock Properties