• <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(太子) 閱讀(1809) 評論(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也不是萬能的  回復  更多評論
              
            一本色综合久久| 久久久久久久久久免免费精品| 久久精品亚洲AV久久久无码| 欧美成人免费观看久久| 久久亚洲日韩精品一区二区三区| 精品蜜臀久久久久99网站| 国产精品久久久久久久久久免费| 亚洲伊人久久综合影院| 97久久久精品综合88久久| 香蕉99久久国产综合精品宅男自| 狠狠色婷婷久久一区二区 | 久久影院综合精品| 久久免费99精品国产自在现线 | 久久久久亚洲AV无码永不| 国产香蕉97碰碰久久人人| 亚洲精品国产字幕久久不卡| 成人精品一区二区久久| 日韩av无码久久精品免费| 久久人人爽人人澡人人高潮AV | 狠狠色丁香久久婷婷综合蜜芽五月 | 久久亚洲精品无码aⅴ大香| 四虎国产永久免费久久| 国产精品女同久久久久电影院| 婷婷久久综合九色综合绿巨人| 国产激情久久久久影院老熟女| 久久精品九九亚洲精品| 色欲久久久天天天综合网| 久久久久99这里有精品10| 久久国产视屏| 精品久久久久久国产牛牛app | 久久www免费人成看片| 热综合一本伊人久久精品 | 久久久久99精品成人片试看| 伊人色综合久久天天人守人婷| 久久亚洲国产成人影院网站| 久久男人中文字幕资源站| 97超级碰碰碰碰久久久久| 91精品国产高清久久久久久91| 国产精品免费久久| 久久久精品国产Sm最大网站| 少妇被又大又粗又爽毛片久久黑人 |