• <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也不是萬能的  回復  更多評論
              
            久久综合欧美成人| 国内精品久久九九国产精品| 国产91久久综合| 久久久久亚洲AV综合波多野结衣 | 亚洲精品高清久久| 久久久久亚洲AV综合波多野结衣| 久久青青草视频| 欧美激情精品久久久久| 久久亚洲电影| 国产精品久久久久国产A级| 久久综合伊人77777| 久久久久亚洲精品无码蜜桃 | 精品久久久久久综合日本| 久久黄视频| 国产99精品久久| 无码人妻少妇久久中文字幕蜜桃| 伊人久久精品线影院| 亚洲国产精品久久电影欧美| 91精品国产91热久久久久福利| 精品国产乱码久久久久久呢| 精品国产综合区久久久久久| 久久精品毛片免费观看| 久久精品国产男包| 久久久网中文字幕| 久久亚洲精品中文字幕三区| 奇米综合四色77777久久| 天堂无码久久综合东京热| 国内精品久久久久久久亚洲| 久久99精品国产自在现线小黄鸭| 久久99这里只有精品国产| 久久中文字幕视频、最近更新| 亚洲国产精品一区二区久久| 久久91精品国产91久久麻豆| 日韩人妻无码精品久久免费一 | 无码8090精品久久一区| 26uuu久久五月天| 日本精品久久久久中文字幕| 精品亚洲综合久久中文字幕| 久久青青草原精品影院| 一本一道久久精品综合| 久久五月精品中文字幕|