• <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也不是萬能的  回復  更多評論
              
            久久er99热精品一区二区| av无码久久久久久不卡网站| 国产精品欧美亚洲韩国日本久久| 2019久久久高清456| 久久免费视频6| 国产一区二区久久久| 久久久久久国产精品无码下载| 色婷婷噜噜久久国产精品12p| 中文字幕乱码人妻无码久久| 精产国品久久一二三产区区别| 亚洲精品乱码久久久久久自慰| 国产毛片欧美毛片久久久| 久久精品国产精品青草| 精品久久久久国产免费| 无码AV中文字幕久久专区| AAA级久久久精品无码片| 久久丝袜精品中文字幕| 思思久久99热只有频精品66| 999久久久国产精品| 精品久久久久久久久久中文字幕 | 国产毛片久久久久久国产毛片| 国产福利电影一区二区三区,免费久久久久久久精 | 无码人妻精品一区二区三区久久久 | 国内精品久久久久影院一蜜桃| 国产精品视频久久久| 无码人妻久久一区二区三区| 亚洲午夜福利精品久久| 日韩亚洲欧美久久久www综合网| 久久久久久久97| 亚洲AV无一区二区三区久久| 亚洲国产成人精品无码久久久久久综合 | 久久久久亚洲av无码专区| 久久精品夜色噜噜亚洲A∨| 日韩欧美亚洲综合久久 | 亚洲欧洲日产国码无码久久99| 77777亚洲午夜久久多喷| 蜜臀久久99精品久久久久久小说| 久久亚洲AV成人无码电影| 久久无码高潮喷水| 国产精品成人久久久久久久| 久久久久久久久66精品片|