Propertysheet Handler Appwizard

Property Sheet Wizard is a Visual C++ 4.0
AppWizard (it won’t work with 5.0 for some reason…I havn’t tested
it with 6.0 though) that creates a shell extension DLL that adds
another property page to the Properties dialog, as shown on the
left. (Right-click on a file and choose Properties to display this
dialog). The DLL supports self registration, that is you can
register it with regsvr32.

To use this AppWizard, first it needs to be
copied to your \BIN\IDE directory (for example mine is
C:\MSDEV\BIN\IDE), then it will be displayed in the New Project
dialog in Visual C++. Choose it to create a new property sheet file
handler.

There are no steps to the AppWizard, it just
creates a generic shell extension DLL.

For some reason, the .DEF file does not get
added, so you will need to add PROPSHEET.DEF to your project before
compiling. Also make sure to use uuidgen to generate a new CLSID for
the DLL in Properties.h when developing your own shell extensions.

By default, the AppWizard creates a handler
for a folder. Change the parameter to AddSymbol in
CProperties::CPropertiesFactory::UpdateRegistry() in Properties.cpp
to the alais for the file type:


BOOL CProperties::CPropertiesFactory::UpdateRegistry(BOOL bRegister)
{
	CRegisterClass reg(m_clsid, "Bitmap.Properties");

	VERIFY(reg.AddSymbol("bmpfile") == 3);   // Zero based... really %4
	reg.AddEntry("CLSID\\%1\\InProcServer32", "Apartment",
		"ThreadingModel");
	...
}

In the example above we are making a handler for bitmaps,
assuming the alias for bmp files is "bmpfile". Note that is it not the filenames extension. Look in
HKEY_CLASSES_ROOT\. to figure out the alais of a
specific filename extension. When developing your own handlers, make sure to
change "PropSheet.Properties" to something more approiate.

I did not include an example with this project because
it is very easy to make. Just create a new project using the AppWizard, compile
and register it. (Register DLLs by running regsvr32 or choosing Register Control
from the Tools menu when the project is loaded in Visual C++). Then right-click
on any folder on your hard disk and choose Properties. Something similar to this should appear.

This code was originally taken from Visual C++ 4.0 How-To, a very useful book by Scott Stanfield and Ralph
Arversen. I wrapped it up into a nice AppWizard and made it generic (it used to
display subfolders there sizes of the selected folder).

Download source - 52.3 KB

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read