• <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);
            }


            例子中的代碼是不能按照預(yù)想的工作的, 因為回調(diào)函數(shù)接收的2個參數(shù)是用SetItemData傳入的值,而不是Item的Index!
            posted on 2007-02-28 22:59 shaker(太子) 閱讀(1820) 評論(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.”  回復(fù)  更多評論
              
            # re: MSDN的Bug! 2007-03-01 22:49 | shaker
            @mzh
            你看函數(shù)用法雖然是這么說明的,
            但是你看例子中的用法是錯了的!  回復(fù)  更多評論
              
            # re: MSDN的Bug! 2007-06-06 08:29 | Mickey Mouse
            看來msdn也不是萬能的  回復(fù)  更多評論
              
            一本伊大人香蕉久久网手机| 四虎国产精品成人免费久久| 久久99国产精一区二区三区| 久久综合丁香激情久久| 久久国产精品一区| 亚洲国产欧洲综合997久久| 三上悠亚久久精品| 久久久久久亚洲精品不卡| 久久精品国产AV一区二区三区| 国产成人精品久久二区二区| 国内精品欧美久久精品| 新狼窝色AV性久久久久久| AV无码久久久久不卡蜜桃| 久久强奷乱码老熟女| 久久r热这里有精品视频| 亚洲人成无码www久久久| 粉嫩小泬无遮挡久久久久久| 久久性精品| 成人午夜精品久久久久久久小说 | 国产福利电影一区二区三区久久老子无码午夜伦不 | 亚洲精品第一综合99久久| www.久久99| 亚洲va中文字幕无码久久不卡| 国产成人无码精品久久久免费| 欧美一区二区三区久久综| 午夜精品久久久久久| 狠狠精品久久久无码中文字幕| 久久w5ww成w人免费| 久久久久久久波多野结衣高潮| 久久精品国产亚洲一区二区三区 | 亚洲欧美国产精品专区久久| 国产精品岛国久久久久| 久久青青草原亚洲av无码app| 亚洲国产天堂久久综合| 久久激情五月丁香伊人| 久久精品18| 久久夜色精品国产| 一本久久a久久精品综合香蕉| 国产成人精品久久| 久久性精品| 亚洲午夜久久久久妓女影院 |