다음을 통해 공유


MFC ActiveX Controls: Using Stock Property Pages

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(CMyAxOptCtrl, 4)
   PROPPAGEID(CMyAxOptPropPage::guid)
   PROPPAGEID(CLSID_CFontPropPage)
   PROPPAGEID(CLSID_CColorPropPage)
   PROPPAGEID(CLSID_CPicturePropPage)
END_PROPPAGEIDS(CMyAxOptCtrl)

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 (MFCxx.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 previous Note), register the DLL by running RegSvr32.exe from the command line with the full path name to the DLL.

See Also

Concepts

MFC ActiveX Controls

MFC ActiveX Controls: Adding Stock Properties