Smartphone List View usage logs

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.