• <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(太子) 閱讀(1809) 評論(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也不是萬能的  回復  更多評論
              
            AV无码久久久久不卡网站下载 | 精品国产91久久久久久久| 99久久精品国产麻豆| 精品久久人人做人人爽综合| 国产精品久久婷婷六月丁香| 久久久国产精品亚洲一区| 久久WWW免费人成—看片| 中文精品久久久久人妻不卡| 成人亚洲欧美久久久久| 狠狠色丁香久久婷婷综合图片| 97热久久免费频精品99| 综合久久一区二区三区 | 欧美午夜精品久久久久久浪潮| 人妻无码精品久久亚瑟影视| 久久亚洲高清观看| 一本一本久久A久久综合精品 | 国产产无码乱码精品久久鸭| 欧美久久一区二区三区| 久久91精品久久91综合| 亚洲综合伊人久久大杳蕉| 久久亚洲中文字幕精品一区四| 蜜臀av性久久久久蜜臀aⅴ麻豆 | 久久久亚洲欧洲日产国码是AV| 色综合久久中文综合网| 亚洲精品乱码久久久久66| 中文字幕无码av激情不卡久久| 美女写真久久影院| 国产三级久久久精品麻豆三级 | 色综合久久久久综合体桃花网| 欧美成a人片免费看久久| 日本免费一区二区久久人人澡| 嫩草伊人久久精品少妇AV| 亚洲狠狠婷婷综合久久蜜芽| 久久精品一本到99热免费| 久久亚洲精品国产亚洲老地址| 国产农村妇女毛片精品久久| 亚洲一本综合久久| 国产成人综合久久精品尤物| 91精品国产91久久久久久青草| 久久综合欧美成人| 久久久WWW免费人成精品|