• <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也不是萬能的  回復  更多評論
              
            精品国产乱码久久久久久人妻| 国产精品一区二区久久不卡 | 久久婷婷五月综合色高清 | 亚洲综合久久久| 浪潮AV色综合久久天堂| 久久免费视频网站| 综合久久精品色| 精品久久久久久无码中文字幕一区| 97久久超碰成人精品网站| 久久嫩草影院免费看夜色| 久久综合给合久久狠狠狠97色| 国产精品免费久久| 日日噜噜夜夜狠狠久久丁香五月| 久久精品草草草| 久久精品国产99国产精品亚洲| 国产精品99久久久久久www| 2021国内久久精品| 久久九九久精品国产| 久久精品无码午夜福利理论片| 久久影视综合亚洲| 亚洲天堂久久精品| 色诱久久久久综合网ywww| 日韩AV毛片精品久久久| 一本大道加勒比久久综合| 国产亚洲精久久久久久无码| 久久久久久久91精品免费观看| 激情久久久久久久久久| 精品久久777| 国产精品久久网| 九九精品99久久久香蕉| 久久久久久精品无码人妻| 波多野结衣久久一区二区| 午夜精品久久久久久影视777| 亚洲国产精品一区二区久久| 国产精品99久久久久久人| 99久久人妻无码精品系列| 久久久久久亚洲AV无码专区| 久久久久亚洲AV无码专区体验| 久久久久AV综合网成人| 97久久综合精品久久久综合 | 久久久亚洲精品蜜桃臀|