Export (0) Print
Expand All

ATLPages Sample: Implements a Property Page Using IPropertyPageImpl 

Download sample

The ATLPages sample demonstrates the implementation of a property page using IPropertyPageImpl.

This sample consists of:

  • A property page class, CDocumentProperties, that uses the EnvDTE::Document interface to display (and allow changes to) the properties of a text document.

  • A helper component, CHelper, that exposes a simplified wrapper to the OleCreatePropertyFrame API to scripting languages.

  • A simple test macro, Test in the ATLPages.vsmacros project, that uses the helper to display the property page for the active document within the Visual C++ editor.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.

Building and Running the Sample

To run the sample, you need to build the solution and then run the test macro.

To build this sample

  1. Open the solution file ATLPages7.sln.

  2. From the Build menu, click Build Solution.

To run the macro

  1. Open a text document in the editor. For example, open one of the source files for the ATLPages sample.

  2. From the Tools menu, point to Macros and then click Macro Explorer. This will open the Macro Explorer window.

  3. From the Tools menu, point to Macros and then click Load Macro Project. This will open the Add Macro Project dialog box.

  4. Browse to the location of the ATLPages.vsmacros file (it's in the same folder as the ATLPages sample) and click the Open button. This action will load the macros file and it will appear in the Macro Explorer.

  5. Expand the ATLPages node and double-click the Test macro.

    If no text document is open when you run the macro, it does nothing. If a document is open, a property page for that document will be displayed indicating the name of the file and its read-only status. You can change either of these items. Your changes will be applied when you click the Apply or OK button. Changing the name of the file will cause the file to be saved to disk under the new name. Changing the read-only status of the file affects whether the file can be changed within the Visual C++ editor (it doesn't affect the read-only attribute of the file on disk).

    NoteNote

    Changing the read-only property of files under source code control is not possible using this property page.

Keywords

This sample uses the following keywords:

IPropertyPage, IPropertyPageImpl, OleCreatePropertyFrame, IPropertyPage::SetObjects, IPropertyPage::Activate, IPropertyPage::Apply, EnvDTE

See Also

Other Resources

ATL Samples

Community Additions

ADD
Show:
© 2014 Microsoft