Create a List View Control
// Create listview
Hwndret = createwindow (wc_listview, null,
Ws_child |
Ws_visible |
Lvs_report |
/* Lvs_ownerdata | * // description 1
Lvs_nocolumnheader,
0,
0,
Mainrect. Right-mainrect. Left,
Mainrect. Bottom-mainrect. Top,
Hwndprnt,
(Hmenu) id_listview, // Control ID
G_hinst, 0 );
Note 1: If lvs_ownerdata Peugeot is added when a listview is created, the system will not plot the content inserted by listview_insertitem. The programmer must process the content at wm_notify. The following is an example:
Case wm_notify:
If (id_listview = wparam)
Return onlistviewnotify (hwnd, lparam );
Break;
Lresult onlistviewpolicy (hwnd, lparam)
{
Nmhdr * pnmh = (nmhdr *) lparam;
Lresult = 0;
Switch (pnmh-> code)
{
Case lvn_getdispinfo:
{
Lv_dispinfo * PDI = (lv_dispinfo *) lparam;
If (0 = PDI-> item. isubitem)
{
If (PDI-> item. Mask & lvif_text)
{
Wcscpy (PDI-> item. psztext, l "1213213421 ");
PDI-> item. cchtextmax = wcslen (PDI-> item. psztext );
PDI-> item. iItem;
}
If (PDI-> item. Mask & lvif_image)
{
PDI-> item. iimage = 0;
}
}
Else
{
If (PDI-> item. Mask & lvif_text)
{
PDI-> item. psztext;
PDI-> item. cchtextmax;
PDI-> item. iItem;
PDI-> item. isubitem;
}
}
}
Break;
Case lvn_itemactivate:
Break;
// Handle this variable Y if you want to use the number keys to select
// Items in the view (like how the desktop file explorer lets you
// Select files by typing the first few characters of the file name .)
// This operation y is also used then the control is sent an lvm_finditem
Case lvn_odfinditem:
{
Nmlvfinditem * pfinditem = (nmlvfinditem *) lparam;
// Used if you are trying to find an item in the List View
}
Break;
}
Return (lresult );
}
Otherwise, the system will not send the wm_notify event, and automatically draw the content added by listview_insertitem.