VListVw: Virtual ListView Control Sample

Click to open or copy the files for the VListVw sample.

VListVw is a simple example of implementing a virtual ListView common control in an application. A virtual ListView is not a separate control, but a standard ListView with the LVS_OWNERDATA style. This example creates a ListView control that has the LVS_OWNERDATA style and "virtually" holds 100,000 items. The items are never actually added. Instead, the virtual ListView control is "told" how many items it contains with the LVM_SETITEMCOUNT message. When an item needs to be drawn, the ListView control queries the parent window for display information with the LVN_GETDISPINFO notification.

The ListView control can be placed in any of the four different view modes by selecting the desired view from the View menu. When the view is changed, the sample changes the style while running, using the SetWindowLong API.

Building SDK Samples

This sample uses the following keywords:

aboutdlgproc; checkmenuitem; checkmenuradioitem; createlistview; createwindowex; defwindowproc; destroymenu; destroywindow; dialogbox; dispatchmessage; docontextmenu; enddialog; errorhandler; errorhandlerex; formatmessage; get_wm_command_cmd; get_wm_command_hwnd; get_wm_command_id; getclientrect; getdlgitem; getlasterror; getmenu; getmessage; getparent; getsubmenu; getwindow; getwindowlong; header_layout; imagelist_addicon; imagelist_create; initapplication; initcommoncontrols; initinstance; initlistview; insertlistviewitems; listview_deleteallitems; listview_ensurevisible; listview_insertcolumn; listview_setimagelist; listview_setitemcount; listviewnotify; loadcursor; loadicon; loadimage; loadmenu; loadstring; lstrcpy; mainwndproc; makeintresource; makelangid; messagebox; movewindow; positionheader; postquitmessage; registerclass; registerclassex; resizelistview; setwindowlong; setwindowpos; showwindow; switch; switchview; text; trackpopupmenu; translatemessage; updatemenu; updatewindow; winmain; wsprintf