• <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ù)  更多評論
              
            久久精品国产亚洲精品2020| 天堂无码久久综合东京热| 亚洲va久久久噜噜噜久久狠狠| 国内精品人妻无码久久久影院导航| 久久久亚洲欧洲日产国码是AV| 午夜精品久久久久久毛片| 国产精品久久精品| 久久综合伊人77777麻豆| 久久久无码人妻精品无码| 国产精品99久久久久久宅男| 久久亚洲AV无码精品色午夜| 久久久九九有精品国产| 久久久久久久久66精品片| 国产精品久久一区二区三区 | 欧美亚洲国产精品久久| 国产精品久久久久久久久鸭| 久久亚洲欧洲国产综合| 青青草国产精品久久久久| 国产精品乱码久久久久久软件 | 无遮挡粉嫩小泬久久久久久久| 国产福利电影一区二区三区久久老子无码午夜伦不 | 国产精品久久久久一区二区三区| 综合久久精品色| 欧美亚洲另类久久综合婷婷| 久久九九全国免费| 国内精品久久国产大陆| 日本久久久久亚洲中字幕| 国内精品久久久久影院老司| 久久精品亚洲福利| 国产综合成人久久大片91| 狠狠色丁香久久综合婷婷| 久久棈精品久久久久久噜噜| 久久国产欧美日韩精品| 少妇无套内谢久久久久| 一本大道久久东京热无码AV| 久久激情五月丁香伊人| 久久久久久久国产免费看| 国产亚洲精午夜久久久久久| 国内精品久久久久久久coent| 香蕉久久一区二区不卡无毒影院| 国产精品美女久久久久AV福利|