Compartir a través de


How to: Retrieve Properties Window Field Descriptions

At the bottom of the Properties window, a description area displays information related to the selected property field. This feature is turned on by default. If you want to hide the description field, right-click the Properties window and click Description. Doing so also removes the check mark next to the Description title in the menu window. You can display the field again by following the same steps to toggle Description back on.

The information in the description field comes from ITypeInfo. Each method, interface, coclass, and so on can have an unlocalized helpstring attribute in the type library. The Properties window retrieves the string from GetDocumentation.

To specify localized help strings

  1. Add the helpstringdll attribute to the library statement in the type library (typelib).

    Note

    This step is optional if the type library is in an object library (.olb) file.

  2. Specify helpstringcontext attributes for the strings. You can also specify helpstring attributes.

    These attributes are distinct from the helpfile and helpcontext attributes, which are contained in actual .chm file Help topics.

To retrieve the description information to be displayed for the highlighted property name, the Properties window calls GetDocumentation2 for the property that is selected, specifying the desired lcid attribute for the output string. Internally, ITypeInfo2 finds the .dll file specified in the helpstringdll attribute and calls DLLGetDocumentation on that .dll file with the specified context and lcid attribute.

The signature and implementation of DLLGetDocumentation are:

STDAPI DLLGetDocumentation
(
   ITypeLib * /* ptlib */,
   ITypeInfo * /* ptinfo */,
   LCID /* lcid */,
   DWORD dwCtx,
   BSTR * pbstrHelpString
);

The DLLGetDocumentation function must be an export defined in the .def file for the DLL.

Internally, an .olb file is created which is actually a DLL. This DLL contains one resource, the type library (.tlb) file, and one exported function, DLLGetDocumentation.

In the case of .olb files, the helpstringdll attribute is optional because it is the same file that contains the .tlb file itself.

To get strings to show up in the Descriptions pane, therefore, the minimum you have to do is specify the helpstring attribute in the type library. If you want those strings to be localized, you have to specify the helpstringdll (optional) attribute and the helpstringcontext (required) attribute and implement DLLGetDocumentation.

There are no additional interfaces that need to be implemented when getting localized information through idl's helpstringcontext attribute and DLLGetDocumentation.

Another way of obtaining the localized name and description of a property is by implementing GetLocalizedPropertyInfo. For more information relating to the implementation of this method, see Properties Window Fields and Interfaces.

See Also

Reference

IVsPerPropertyBrowsing

helpstringdll

helpstring

helpstringcontext

helpcontext

helpfile

lcid

Concepts

Properties Window Fields and Interfaces

Other Resources

Properties Window and Property Pages