• <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  評(píng)論-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ù)想的工作的, 因?yàn)榛卣{(diào)函數(shù)接收的2個(gè)參數(shù)是用SetItemData傳入的值,而不是Item的Index!
            posted on 2007-02-28 22:59 shaker(太子) 閱讀(1823) 評(píng)論(3)  編輯 收藏 引用 所屬分類: C++

            評(píng)論:
            # 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ù)  更多評(píng)論
              
            # re: MSDN的Bug! 2007-03-01 22:49 | shaker
            @mzh
            你看函數(shù)用法雖然是這么說(shuō)明的,
            但是你看例子中的用法是錯(cuò)了的!  回復(fù)  更多評(píng)論
              
            # re: MSDN的Bug! 2007-06-06 08:29 | Mickey Mouse
            看來(lái)msdn也不是萬(wàn)能的  回復(fù)  更多評(píng)論
              
            久久精品中文字幕一区| 99久久99久久精品免费看蜜桃| 九九久久精品国产| 2021国内久久精品| 久久久久亚洲精品无码蜜桃| 国产高潮国产高潮久久久91| 伊人久久精品无码av一区| 久久婷婷国产麻豆91天堂| 亚洲v国产v天堂a无码久久| 狠狠色婷婷综合天天久久丁香| 久久久久久毛片免费看 | 色偷偷888欧美精品久久久| 久久久久久噜噜精品免费直播| 人妻久久久一区二区三区| 欧美日韩精品久久久久| 亚洲狠狠综合久久| 久久精品国产清高在天天线| 国产精品美女久久福利网站| 久久精品18| 四虎国产精品免费久久5151| 久久久久久久久久久久中文字幕| 亚洲欧美日韩久久精品| 久久亚洲av无码精品浪潮| 99久久精品国产毛片| 色综合久久88色综合天天| 国产精品久久久亚洲| 久久精品国产亚洲av麻豆小说| 亚洲欧美日韩中文久久| 亚洲精品乱码久久久久久蜜桃图片 | 日本亚洲色大成网站WWW久久 | 女人高潮久久久叫人喷水| 久久综合狠狠综合久久97色| 久久久WWW成人| 日韩AV毛片精品久久久| 日韩精品无码久久一区二区三| 久久久久国产精品嫩草影院| 久久久受www免费人成| 2021最新久久久视精品爱| 亚洲中文字幕无码久久2017| 午夜天堂精品久久久久| 成人久久久观看免费毛片|