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


            例子中的代碼是不能按照預想的工作的, 因為回調函數接收的2個參數是用SetItemData傳入的值,而不是Item的Index!
            posted on 2007-02-28 22:59 shaker(太子) 閱讀(1823) 評論(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.”  回復  更多評論
              
            # re: MSDN的Bug! 2007-03-01 22:49 | shaker
            @mzh
            你看函數用法雖然是這么說明的,
            但是你看例子中的用法是錯了的!  回復  更多評論
              
            # re: MSDN的Bug! 2007-06-06 08:29 | Mickey Mouse
            看來msdn也不是萬能的  回復  更多評論
              
            亚洲国产小视频精品久久久三级 | 国产精品久久久久久久久免费| 一本色道久久HEZYO无码| 久久亚洲精品人成综合网| 久久精品成人免费看| 久久这里只有精品视频99| 久久精品九九亚洲精品| 久久综合丁香激情久久| 亚洲国产天堂久久综合| 国产精品18久久久久久vr | 伊人久久精品无码av一区| 久久不射电影网| 无码AV中文字幕久久专区| 久久久久国产| 青青青国产精品国产精品久久久久 | 久久综合狠狠综合久久综合88| 国产精品免费久久久久久久久| 亚洲熟妇无码另类久久久| 久久精品无码一区二区三区免费 | 久久成人18免费网站| 久久久久99精品成人片欧美| 色婷婷综合久久久久中文字幕| 精品熟女少妇av免费久久| 久久久噜噜噜久久中文字幕色伊伊 | 无码人妻久久一区二区三区免费丨| 91超碰碰碰碰久久久久久综合| 久久综合噜噜激激的五月天| 久久久久久久久波多野高潮| 少妇久久久久久被弄到高潮 | 久久精品视频网| 精品一区二区久久久久久久网站| 久久亚洲私人国产精品| 亚洲精品蜜桃久久久久久| 无码日韩人妻精品久久蜜桃| 久久久久久久久久久| 午夜人妻久久久久久久久| 亚洲人成伊人成综合网久久久| 午夜福利91久久福利| 日日狠狠久久偷偷色综合0| 日韩亚洲国产综合久久久| 久久久无码精品亚洲日韩蜜臀浪潮 |