• <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ù)  更多評論
              
            久久国产精品无| 狠狠综合久久综合中文88| 亚洲国产精品综合久久网络 | 欧美亚洲日本久久精品| 久久久久久亚洲精品无码| 国产精品久久久久蜜芽| 久久亚洲精精品中文字幕| 人妻精品久久久久中文字幕69| 国产午夜精品理论片久久影视 | 国产成人无码精品久久久免费 | 久久人人爽人人人人爽AV| 97久久精品无码一区二区| 免费一级欧美大片久久网| 久久久久久无码Av成人影院| 国产香蕉97碰碰久久人人| 久久综合88熟人妻| 国产69精品久久久久观看软件| 97久久国产亚洲精品超碰热| 一本一道久久综合狠狠老| 久久精品国产精品亚洲艾草网美妙 | 99久久精品国产一区二区三区 | 无码8090精品久久一区| 2022年国产精品久久久久| 中文字幕无码免费久久| 四虎影视久久久免费| 精品久久久无码中文字幕| AV无码久久久久不卡蜜桃| 久久热这里只有精品在线观看| 国产精品无码久久综合网| 久久精品国产91久久麻豆自制| 麻豆成人久久精品二区三区免费| 久久久久久久波多野结衣高潮 | 久久亚洲精品国产精品| 中文字幕人妻色偷偷久久| 2021国产精品午夜久久| 久久国产劲爆AV内射—百度| 久久久精品久久久久影院| 7777精品伊人久久久大香线蕉| 亚洲午夜无码AV毛片久久| 久久亚洲AV成人无码| 国产毛片欧美毛片久久久|