• <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)論
              
            97久久国产露脸精品国产| 亚洲va久久久噜噜噜久久| 漂亮人妻被黑人久久精品| 国产精品久久久久9999高清| 国产精品内射久久久久欢欢| 色偷偷91久久综合噜噜噜噜| 一级做a爱片久久毛片| 亚洲午夜久久久久久噜噜噜| 久久精品人人槡人妻人人玩AV| 无夜精品久久久久久| 久久久久久久波多野结衣高潮| 久久99精品久久久久久9蜜桃| 久久91精品国产91久久麻豆| 午夜精品久久久久久中宇| 久久亚洲欧美日本精品| 999久久久免费精品国产| 性做久久久久久久久| 久久精品国产精品青草| 久久久久国产精品人妻| 秋霞久久国产精品电影院| 亚洲人成伊人成综合网久久久| 99久久精品国产一区二区| 久久久无码精品亚洲日韩按摩| 中文字幕精品久久| 久久精品免费全国观看国产| 99久久综合国产精品免费| 色综合久久夜色精品国产| 久久精品国产亚洲精品| 久久亚洲精品国产精品婷婷| 久久久久亚洲AV成人网| 亚洲国产精品人久久| 久久精品www人人爽人人| 亚洲精品国精品久久99热一| 中文国产成人精品久久亚洲精品AⅤ无码精品| 久久综合九色综合欧美狠狠| 99久久免费国产精精品| 少妇久久久久久久久久| 亚洲综合日韩久久成人AV| 久久久www免费人成精品| 久久久久亚洲av成人网人人软件| 久久激情亚洲精品无码?V|