• <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(太子) 閱讀(1811) 評論(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ù)  更多評論
              
            久久影院亚洲一区| 久久精品一区二区三区中文字幕| 狠狠色丁香久久婷婷综合图片| 亚洲Av无码国产情品久久| 伊人久久久AV老熟妇色| 久久久久人妻精品一区| 精品无码久久久久久国产| 色欲久久久天天天综合网精品| 大美女久久久久久j久久| 久久国语露脸国产精品电影| 久久九九亚洲精品| 欧洲精品久久久av无码电影| 亚洲一区中文字幕久久| 久久亚洲春色中文字幕久久久| 国内精品伊人久久久久网站| 久久婷婷五月综合97色| 中文精品久久久久人妻| 99精品久久久久久久婷婷| 伊人久久大香线蕉av不卡| 久久久人妻精品无码一区| 国产亚洲欧美成人久久片| 国产亚洲精久久久久久无码77777| 久久无码av三级| 99re这里只有精品热久久| 久久久久se色偷偷亚洲精品av| 国产精品99久久久久久董美香| 精品久久久久久无码中文字幕一区| 伊人久久精品影院| 久久久久久av无码免费看大片| 国产精品青草久久久久福利99| 2021久久精品国产99国产精品| 中文字幕乱码人妻无码久久| 日韩人妻无码一区二区三区久久99 | 一级做a爰片久久毛片人呢| 亚洲香蕉网久久综合影视 | 99久久婷婷国产一区二区| 99久久国产综合精品麻豆| 麻豆一区二区99久久久久| 久久久久亚洲AV无码永不| 久久精品水蜜桃av综合天堂| 午夜天堂av天堂久久久|