Tag Archives: vista

Tree-View Control – TVS_EX_RICHTOOLTIP style

Windows Vista introduced a buch of extended styles for tree-view control (SysTreeView32). Among them, there is TVS_EX_RICHTOOLTIP style which is described in MSDN documentation as follows: “Allow rich tooltips in the tree view (custom drawn with icon and text)”. This article shows a little bit more about how to set and which is the effect of using this extended style.

How to set and remove TVS_EX_RICHTOOLTIP style

Like the other tree-view extended styles, TVS_EX_RICHTOOLTIP can be set or removed as follows:

Sending TVM_SETEXTENDEDSTYLE message

Using TreeView_SetExtendedStyle macro

Calling CTreeCtrl::SetExtendedStyle (MFC)

Further, let’s use the above code and see what’s happen.

The effect of TVS_EX_RICHTOOLTIP style

By default, if the mouse pointer hovers a partially visible tree item, a tootip containing the item’s text is shown.

Tree item tooltip - TVS_EX_RICHTOOLTIP not set

Tree item tooltip – TVS_EX_RICHTOOLTIP not set

If the TVS_EX_RICHTOOLTIP style is set, then the tooltip displays the item’s icon in addition to the item’s text.

Tree item tooltip - TVS_EX_RICHTOOLTIP set

Tree item tooltip – TVS_EX_RICHTOOLTIP set

Note that TVS_EX_RICHTOOLTIP has no effect if TVS_INFOTIP style is set. In this case, the tooltip shows the text provided in TVN_GETINFOTIP notification handler and no icon. So far, that’s all I found about it. If somebody can reveal more, please do not hesitate to leave a reply!

Downloads

Demo project (Visual Studio 2013) – TVS_EX_RICHTOOLTIP_Demo.zip (551)

Resources

File Open Dialog with Multiple Selection – Part 3: Cutting the Dog Tail

First two articles in this series show how to deal with a large number of selected items, by manipulating the OPENFILENAME::lpstrFile buffer, either for old style or Vista-style Open File dialogs. However, if the target system is Windows Vista or newer, we should prefer getting rid of old stuff and use only Vista-style dialogs.
So, let’s cut the dog’s tail as fast and painless as possible!

Using IFileOpenDialog to collect the results

Example 5

This time, we’ve used Common Item Dialog API (IFileOpenDialog interface and so on) instead of the “classic” CFileDialog::GetStartPosition and CFileDialog::GetNextPathName. That allows to step beyond the old stuff limits without overriding any CFileDialog method and without doing any other type of “dancing on the rope”.

Demo application

Vista File Open Dialog with Multiple Selection - Demo

Vista File Open Dialog with Multiple Selection – Demo

The demo application demonstrates how to grab File Open dialog results by using Common Item Dialog API. For demo/testing purpose it has also a function which uses the old way of CFileDialog::GetNextPathName. Just uncheck “Use IFileOpenDialog”, push “Open…” button, select a large number of items from the open file dialog list, then see the difference.

Demo project download: Vista File Open Dialog with Multiple Selection (621)

Notes

  • Common Item Dialog API is supported on Windows Vista and newer.
  • CFileDialog with Vista style is implemented in Visual Studio 2008 and newer.
  • Of course may be also other solutions. For example, someone still would prefer to derive from CFileDialog in order to put all COM stuff in a single place, for making others’ life easier.
  • For any constructive remark or alternative solution(s), please do not hesitate and leave a comment!

Resources

  • MSDN and Windows Dev Center (see the links in the previous articles).

See also