• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆-60  評論-111  文章-0  trackbacks-0
            msdn原文

            CListCtrl::SortItems

            This method sorts list view items using an application-defined comparison function. The index of each item changes to reflect the new sequence.

            BOOL SortItems( PFNLVCOMPARE pfnCompare, DWORD dwData);
            Parameters
            pfnCompare
            Specifies the address of the application-defined comparison function. The comparison function is called during the sort operation each time the relative order of two list items needs to be compared. The comparison function must be either a static member of a class or a standalone function that is not a member of any class.
            dwData
            Specifies the application-defined value that is passed to the comparison function.
            Return Value

            Nonzero if it is successful; otherwise, it is zero. Remarks
            The comparison function has the following form:
            int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, ??LPARAM lParamSort);

            The comparison function must return a negative value if the first item should precede the second, a positive value if the first item should follow the second, or zero if the two items are equivalent.
            The lParam1 and lParam2 parameters specify the item data for the two items being compared. The lParamSort parameter is the same as the dwData value.

            Example


            //?Sort?the?item?in?reverse?alphabetical?order.
            static?int?CALLBACK?
            MyCompareProc(LPARAM?lParam1,?LPARAM?lParam2,?LPARAM?lParamSort)
            {
            ???
            //?lParamSort?contains?a?pointer?to?the?list?view?control.
            ???CListCtrl*?pListCtrl?=?(CListCtrl*)?lParamSort;
            ???CString????strItem1?
            =?pListCtrl->GetItemText(lParam1,?0);
            ???CString????strItem2?
            =?pListCtrl->GetItemText(lParam2,?0);

            ???
            return?strcmp(strItem2,?strItem1);
            }

            void?snip_CListCtrl_SortItems()
            {
            ???
            //?The?pointer?to?my?list?view?control.
            ???extern?CListCtrl*?pmyListCtrl;

            ???
            //?Sort?the?list?view?items?using?my?callback?procedure.
            ???pmyListCtrl->SortItems(MyCompareProc,?(LPARAM)?pmyListCtrl);
            }


            例子中的代碼是不能按照預想的工作的, 因為回調函數接收的2個參數是用SetItemData傳入的值,而不是Item的Index!
            posted on 2007-02-28 22:59 shaker(太子) 閱讀(1823) 評論(3)  編輯 收藏 引用 所屬分類: C++

            評論:
            # re: MSDN的Bug! 2007-03-01 09:07 | mzh
            “The lParam1 and lParam2 parameters specify the item data for the two items being compared.”  回復  更多評論
              
            # re: MSDN的Bug! 2007-03-01 22:49 | shaker
            @mzh
            你看函數用法雖然是這么說明的,
            但是你看例子中的用法是錯了的!  回復  更多評論
              
            # re: MSDN的Bug! 2007-06-06 08:29 | Mickey Mouse
            看來msdn也不是萬能的  回復  更多評論
              
            久久超碰97人人做人人爱| 久久人人爽人人爽人人片AV麻烦| 怡红院日本一道日本久久 | 久久国产精品无码HDAV| 国产精品国色综合久久| 中文字幕亚洲综合久久菠萝蜜| 色综合久久久久综合体桃花网| 曰曰摸天天摸人人看久久久| 女人高潮久久久叫人喷水| 亚洲第一极品精品无码久久| 99久久综合国产精品二区| 国产一级做a爰片久久毛片| 国内精品人妻无码久久久影院导航| 国产精品美女久久久久av爽| 久久99热这里只频精品6| 日本精品久久久久影院日本| 久久久久久久尹人综合网亚洲 | 久久精品国产亚洲AV不卡| 无码人妻久久一区二区三区免费丨| 国产亚洲色婷婷久久99精品| 日产久久强奸免费的看| 91精品国产91久久久久久| 久久99国产乱子伦精品免费| 中文字幕久久精品| 久久九九久精品国产免费直播| 国产精品久久午夜夜伦鲁鲁| 久久久久久亚洲Av无码精品专口| 亚洲伊人久久成综合人影院| 久久免费国产精品| 亚洲性久久久影院| 国产高清美女一级a毛片久久w| 蜜臀av性久久久久蜜臀aⅴ麻豆| 久久精品人人做人人妻人人玩| 久久精品卫校国产小美女| 国产精品久久久久久久久软件| 婷婷久久五月天| 亚洲综合久久久| 亚洲色大成网站www久久九| 久久强奷乱码老熟女网站| 久久久久久曰本AV免费免费| 久久精品卫校国产小美女|