Click here to Skip to main content
15,896,726 members
Articles / Desktop Programming / ATL

Adding Custom Pages to Control Panel Applets

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
3 Apr 2001 161K   1.4K   62  
This article shows how to add your own pages to Control Panel applets by writing a property sheet handler.
// DisplayCplExt.h : Declaration of the CDisplayCplExt

#ifndef __DISPLAYCPLEXT_H_
#define __DISPLAYCPLEXT_H_

#include "resource.h"       // main symbols
#include <comdef.h>
#include <shlobj.h>

/////////////////////////////////////////////////////////////////////////////
// CDisplayCplExt

class ATL_NO_VTABLE CDisplayCplExt : 
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CDisplayCplExt, &CLSID_DisplayCplExt>,
    public IDispatchImpl<IDisplayCplExt, &IID_IDisplayCplExt, &LIBID_DISPLAYPAGELib>,
    public IShellExtInit,
    public IShellPropSheetExt
{
public:
    CDisplayCplExt()
    {
    }

DECLARE_REGISTRY_RESOURCEID(IDR_DISPLAYCPLEXT)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CDisplayCplExt)
    COM_INTERFACE_ENTRY(IDisplayCplExt)
    COM_INTERFACE_ENTRY(IDispatch)
    COM_INTERFACE_ENTRY(IShellExtInit)
    COM_INTERFACE_ENTRY(IShellPropSheetExt)
END_COM_MAP()

public:
    // IDisplayCplExt

    // IShellExtInit
    STDMETHOD(Initialize)(LPCITEMIDLIST pidlFolder,
                          IDataObject *lpdobj, HKEY hkeyProgID);

    // IShellPropSheetExt
    STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam);
    STDMETHOD(ReplacePage)(UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam);
};

#endif //__DISPLAYCPLEXT_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior) VMware
United States United States
Michael lives in sunny Mountain View, California. He started programming with an Apple //e in 4th grade, graduated from UCLA with a math degree in 1994, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.
Mike has been a a developer at Napster and at his own lil' startup, Zabersoft, a development company he co-founded with offices in Los Angeles and Odense, Denmark. Mike is now a senior engineer at VMware.

He also enjoys his hobbies of playing pinball, bike riding, photography, and Domion on Friday nights (current favorite combo: Village + double Pirate Ship). He would get his own snooker table too if they weren't so darn big! He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.

Mike was a VC MVP from 2005 to 2009.

Comments and Discussions