Help and Support
 

powered byLive Search

How to implement a ListView control that is similar to Windows Explorer by using DirLV.exe

Article ID:234310
Last Review:November 21, 2006
Revision:4.1
This article was previously published under Q234310

SUMMARY

DirLV.exe is a sample that demonstrates how to implement an Explorer-like ListView control. The control handles some user-defined messages that make it display the contents of a specified directory. The ListView control displays the associated icon, the long file name, the size of the file, the file type, its creation date, and the file attributes.

The sample illustrates how to:
Use the system image list in an MFC application to display the icon associated with every file.
Implement the ListView control as a virtual ListView, that is, specify LVS_OWNERDATA as a style for the ListView control. This causes the system to send LVN_GETDISPINFO notifications to the control's parent for every item in the list that needs to be displayed. This approach greatly improves performance for large directories.
Implement mouse and keyboard navigation: double-clicking a directory, or pressing ENTER when the focus item is a directory, changes the displayed directory.
Use a fast sorting algorithm provided in the Standard Template Library (STL), to order the files alphabetically.
The sample does not use ITEMIDLISTs to identify shell elements (that is, files) nor does it use any of the associated shell interfaces. As a consequence, it does not recognize link files as such, it does not handle virtual directories, and it fails to identify an icon for console applications that don't have an icon associated with them.

Back to the top

MORE INFORMATION

The following files are available for download from the Microsoft Download Center:

DirLV.exe (http://download.microsoft.com/download/vc60pro/other/1.0/win98/en-us/dirlv.exe)

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 (http://support.microsoft.com/kb/119591/EN-US/) How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Back to the top

REFERENCES

See the VListVw sample in the Online documentation.

(c) Microsoft Corporation Cosmin Radu, All Rights Reserved. Contributions by 1999, Microsoft Corporation.

Back to the top


APPLIES TO
Microsoft Foundation Class Library 4.2, when used with:
  Microsoft Visual C++ 5.0 Enterprise Edition
  Microsoft Visual C++ 5.0 Professional Edition
  Microsoft Visual C++ 6.0 Enterprise Edition
  Microsoft Visual C++ 6.0 Professional Edition
  Microsoft Visual C++, 32-bit Learning Edition 6.0

Back to the top

Keywords: 
kbdownload kblistview kbcmnctrls kbsample KB234310

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.