xj qian
2024-07-04 d5d98f8ef5077717c723ef1467c98d275a7dedd3
add listbox
已添加2个文件
已修改2个文件
1092 ■■■■■ 文件已修改
jrj/ext-jrj/ext-jrj.vcxproj 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/SO3.list.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xlistbox.hpp 525 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xlistview.hpp 533 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj
@@ -121,6 +121,7 @@
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
      <AdditionalIncludeDirectories>..\xframe;..\xframe\system;..\project</AdditionalIncludeDirectories>
      <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
    </ClCompile>
    <Link>
      <SubSystem>Windows</SubSystem>
@@ -139,7 +140,7 @@
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>NDEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>NDEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_XWIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
@@ -230,6 +231,10 @@
    <ClInclude Include="..\xframe\xcontrol\xflowchart.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xhtml.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xlayersheet.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xlistbox.hpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xlistview.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xreport.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xshtml.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xtreeview.hpp" />
@@ -259,23 +264,26 @@
    </ClCompile>
    <ClCompile Include="..\project\business\GDN\GDNSourcePaperCard.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\GDN\GDNSourcePriceMaint.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\GDN\select.item.po.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\GDN\SelectItem.New.GDN.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\HR\AdministrativeDepartment.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\HR\AdministrativeDepartmentFolder.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\HR\BlankExcelTemplate.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -289,13 +297,14 @@
    </ClCompile>
    <ClCompile Include="..\project\business\HR\ManpowerFileWindow.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\PO\business4.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\PO\Maint.PaperCard.PO.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\PO\Maint.PurcherItem.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
@@ -312,9 +321,11 @@
    </ClCompile>
    <ClCompile Include="..\project\business\Public\message.business.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Public\message.supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\quote.enquiry.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
@@ -346,6 +357,7 @@
    </ClCompile>
    <ClCompile Include="..\project\business\SO\Product.FetchNo.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\SO\Product.Select.SO.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -363,33 +375,43 @@
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\asklist.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\Inspection.Supplie.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\list.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierEx.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierSD.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maintex.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\paymen.Supplie.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\SupplierSource.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\printview\Maint.Template.PrintEx.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
jrj/project/business/SO3.list.cpp
@@ -143,8 +143,8 @@
                dw_list.SetItemString(row, L"ApplyStatus", arg.GetArgString(L"state"));
            if (arg.GetArgString(L"billstatus") != L"")
            {
                string billstatus = arg.GetArgString(L"billstatus");
                string statusName = GetBillStatusName(billstatus);
                xstring billstatus = arg.GetArgString(L"billstatus");
                xstring statusName = GetBillStatusName(billstatus);
                dw_list.SetItemString(row, L"ApprovalStatus", billstatus);
                dw_list.SetItemDisplayString(row, L"ApprovalStatus", statusName);
            }
jrj/xframe/xcontrol/xlistbox.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,525 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "win32/win.hpp"
class xlistbox : public xcontrol
{
    static int GetCount(HWND hWnd)//返回列表项总项数
    {
        int LB_GETCOUNT = 0x018B;
        return SendMessage(hWnd, LB_GETCOUNT, 0, 0);
    }
    static int AddItem(HWND hWnd, string str)//追加一个列表项,如果指定了LBS_SORT风格,将重排序,否则追加到最后
    {
        int LB_ADDSTRING = 0x0180;
        return SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM)str);
    }
    static int AddItem(HWND hWnd, string str, int p)//追加一个列表项,如果指定了LBS_SORT风格,将重排序,否则追加到最后
    {
        int LB_ADDSTRING = 0x0180;
        int nIndex = SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM)str);
        int LB_SETITEMDATA = 0x019A;
        SendMessage(hWnd, LB_SETITEMDATA, nIndex, p);
        return nIndex;
    }
    static int InsertItem(HWND hWnd, int nIndex, string str)//指定位置插入,wParam=-1添加到末尾。如果指定了LBS_SORT风格,则不会重排序,所以LBS_SORT风格下不用。
    {
        int LB_INSERTSTRING = 0x0181;
        return SendMessage(hWnd, LB_INSERTSTRING, nIndex, (LPARAM)str);
    }
    static int DeleteItem(HWND hWnd, int nIndex) //删除指定的列表项,lParam is not used
    {
        int LB_DELETESTRING = 0x0182;
        return SendMessage(hWnd, LB_DELETESTRING, nIndex, 0);
    }
    static int FindString(HWND hWnd, int nIndex, string str)//从指定开始表项序号开始查找指定项,忽略大小写,wParam=-1从第一项找
    {
        int LB_ERR = -1;
        int LB_FINDSTRING = 0x018F;
        int lResult = SendMessage(hWnd, LB_FINDSTRING, nIndex, (LPARAM)str);
        return lResult;
    }
    static int FindStringExact(HWND hWnd, int nIndex, string str)//整个字符串匹配
    {
        int LB_ERR = -1;
        int LB_FINDSTRINGEXACT = 0x01A2;
        int lResult = SendMessage(hWnd, LB_FINDSTRINGEXACT, nIndex, (LPARAM)str);
        return lResult;
    }
    static int GetAnchorIndex(HWND hWnd)//返回鼠标最后选中的项的索引
    {
        int LB_GETANCHORINDEX = 0x019D;
        return SendMessage(hWnd, LB_GETANCHORINDEX, 0, 0);
    }
    static int GetCaretIndex(HWND hWnd)//返回具有矩形焦点的项的索引
    {
        int LB_GETCARETINDEX = 0x019F;
        return SendMessage(hWnd, LB_GETCARETINDEX, 0, 0);
    }
    static int GetCurSel(HWND hWnd)//单选,返回当前被选中项索引
    {
        int LB_GETCURSEL = 0x0188;
        return SendMessage(hWnd, LB_GETCURSEL, 0, 0);
    }
    static int GetHorizon(HWND hWnd)//返回列表框可滚动的宽度(像素)
    {
        int LB_GETHORIZONTALEXTENT = 0x0193;
        return SendMessage(hWnd, LB_GETHORIZONTALEXTENT, 0, 0);
    }
    static int GetItemData(HWND hWnd, int nIndex)//返回指定列表项的附加数据;不是LBS_HASSTRINGS风格的,内容来自于LB_ADDSTRING或LB_INSERTSTRING消息的lParam参数,否则内容来自于LB_SETITEMDATA消息的lParam
    {
        int LB_GETITEMDATA = 0x0199;
        return SendMessage(hWnd, LB_GETITEMDATA, nIndex, 0);
    }
    static int SetItemData(HWND hWnd, int nIndex, string str)//返回指定列表项的附加数据;不是LBS_HASSTRINGS风格的,内容来自于LB_ADDSTRING或LB_INSERTSTRING消息的lParam参数,否则内容来自于LB_SETITEMDATA消息的lParam
    {
        int LB_SETITEMDATA = 0x019A;
        return SendMessage(hWnd, LB_SETITEMDATA, nIndex, (LPARAM)str);
    }
    static int GetItemHeight(HWND hWnd, int nIndex)//返回列表项中某一项的高度(像素);用于LBS_OWNERDRAWVARIABLE风格的,wParam指定的参数
    {
        int LB_GETITEMHEIGHT = 0x01A1;
        return SendMessage(hWnd, LB_GETITEMHEIGHT, nIndex, 0);
    }
    /*static Rect GetItemRect(HWND hWnd,int nIndex)//获得列表项的客户区RECT
    {
          int LB_GETITEMRECT  = 0x0198;
          xrect rect;
          return SendMessage(hWnd,LB_GETITEMRECT,nIndex,rect);
    }*/
    static int GetSel(HWND hWnd, int nIndex)//返回指定列表项的状态,如果查询的列表项被选择了返回一个正值,否则返回0
    {
        int LB_GETSEL = 0x0187;
        return SendMessage(hWnd, LB_GETSEL, nIndex, 0);
    }
    static int GetSelCount(HWND hWnd)//返回选择项的数目,仅用于多重选择列表框
    {
        int LB_GETSELCOUNT = 0x0190;
        return SendMessage(hWnd, LB_GETSELCOUNT, 0, 0);
    }
    static int GetSelItems(HWND hWnd)//获取选中项的数目和位置,仅用于多重选择列表框。wParam说明数组缓冲区的大小,lParam指向一个整型数组缓冲区
    {
        int LB_GETSELITEMS = 0x0191;
        int nMax = GetSelCount(hWnd);
        int nItems;
        return SendMessage(hWnd, LB_GETSELITEMS, nMax, nItems);
    }
    static string GetText(HWND hWnd, int nIndex) //返回文本
    {
        int LB_GETTEXT = 0x0189;
        int LB_GETTEXTLEN = 0x018A;
        int nLen = SendMessage(hWnd, LB_GETTEXTLEN, nIndex, 0);
        string str = new wchar_t[nLen + 1];
        SendMessage(hWnd, LB_GETTEXT, nIndex, (LPARAM)str);
        return str;
    }
    static int GetTextLen(HWND hWnd, int nIndex) //返回当前选中项文本长度
    {
        int LB_GETTEXTLEN = 0x018A;
        return SendMessage(hWnd, LB_GETTEXTLEN, nIndex, 0);
    }
    static int GetTopIndex(HWND hWnd) //第一个可见项的索引
    {
        int LB_GETTOPINDEX = 0x018E;
        return SendMessage(hWnd, LB_GETTOPINDEX, 0, 0);
    }
    static int ResetCount(HWND hWnd)//清除所以列表项
    {
        int LB_RESETCONTENT = 0x0184;
        return SendMessage(hWnd, LB_RESETCONTENT, 0, 0);
    }
    static int SelectString(HWND hWnd, int nIndex, string str) //选中从nIndex开始第一个str,返回选中的Index,只用在单选列表框中
    {
        int LB_SELECTSTRING = 0x018C;
        return SendMessage(hWnd, LB_SELECTSTRING, nIndex, (LPARAM)str);
    }
    static int SelItemRangeEx(HWND hWnd, int sIndex, int eIndex)//仅用于多重选择,从起点-终点
    {
        int LB_SELITEMRANGEEX = 0x0183;
        return SendMessage(hWnd, LB_SELITEMRANGEEX, sIndex, eIndex);
    }
    static int SetAnchorIndex(HWND hWnd, int nIndex)//设置鼠标最后选中的表项成指定表项
    {
        int LB_SETANCHORINDEX = 0x019C;
        return SendMessage(hWnd, LB_SETANCHORINDEX, nIndex, 0);
    }
    /*static int SetCarerIndex(HWND hWnd,int nIndex,bool lParam)//设置键盘输入焦点到指定表项
    {
        int LB_SETCARETINDEX = 0x019E;
        return SendMessage(hWnd,LB_SETCARETINDEX,nIndex,lParam);
    }*/
    static int SetColumnWidth(HWND hWnd, int nWidth)//设置多列列表框宽度,style为多列列表框时有效
    {
        int LB_SETCOLUMNWIDTH = 0x0195;
        SendMessage(hWnd, LB_SETCOLUMNWIDTH, nWidth, 0);
        return 1;
    }
    static int SetCount(HWND hWnd, int nCnt)//设置表项数目
    {
        int LB_SETCOUNT = 0x01A7;
        SendMessage(hWnd, LB_SETCOUNT, nCnt, 0);
        return 1;
    }
    static int SetCurSel(HWND hWnd, int nIndex)//设置指定列表项为当前选择项
    {
        int LB_SETCURSEL = 0x0186;
        return SendMessage(hWnd, LB_SETCURSEL, nIndex, 0);//只用在单选列表框中。nIndex = -1为全不选
    }
    /*static int SetSel(HWND hWnd, bool lbSel,int nIndex)//使指定的列表项选中或不选,用于多选中
    {
          int LB_SETSEL  = 0x0185;
          return SendMessage(hWnd,LB_SETSEL,lbSel,nIndex);//用在多选中,wParm表示是否选,lParam为-1,选择所有
    }
    static bool SetTopIndex(HWND hWnd,int nIndex)//将指定的列表项设置为第一个可见项
    {
         int LB_SETTOPINDEX  = 0x0197;
         return SendMessage(hWnd,LB_SETTOPINDEX,nIndex,0);
    }*/
    int GetCount()//返回列表项总项数
    {
        return GetCount(GetHWND());
    }
    int AddItem(string str)//追加一个列表项,如果指定了LBS_SORT风格,将重排序,否则追加到最后
    {
        return AddItem(GetHWND(), str);
    }
    int AddItem(string str, int p)//追加一个列表项,如果指定了LBS_SORT风格,将重排序,否则追加到最后
    {
        return AddItem(GetHWND(), str, p);
    }
    int InsertItem(int nIndex, string str)//指定位置插入,wParam=-1添加到末尾。如果指定了LBS_SORT风格,则不会重排序,所以LBS_SORT风格下不用。
    {
        return InsertItem(GetHWND(), nIndex, str);
    }
    int DeleteItem(int nIndex) //删除指定的列表项,lParam is not used
    {
        return DeleteItem(GetHWND(), nIndex);
    }
    int FindString(int nIndex, string str)//从指定开始表项序号开始查找指定项,忽略大小写,wParam=-1从第一项找
    {
        return FindString(GetHWND(), nIndex, str);
    }
    int FindStringExact(int nIndex, string str)//整个字符串匹配
    {
        return  FindStringExact(GetHWND(), nIndex, str);
    }
    int GetAnchorIndex()//返回鼠标最后选中的项的索引
    {
        return GetAnchorIndex(GetHWND());
    }
    int GetCaretIndex()//返回具有矩形焦点的项的索引
    {
        return GetCaretIndex(GetHWND());
    }
    int GetCurSel()//单选,返回当前被选中项索引
    {
        return GetCurSel(GetHWND());
    }
    int GetHorizon()//返回列表框可滚动的宽度(像素)
    {
        return GetHorizon(GetHWND());
    }
    int GetItemData(int nIndex)//返回指定列表项的附加数据;不是LBS_HASSTRINGS风格的,内容来自于LB_ADDSTRING或LB_INSERTSTRING消息的lParam参数,否则内容来自于LB_SETITEMDATA消息的lParam
    {
        return GetItemData(GetHWND(),nIndex);
    }
    int SetItemData(int nIndex, int str)//返回指定列表项的附加数据;不是LBS_HASSTRINGS风格的,内容来自于LB_ADDSTRING或LB_INSERTSTRING消息的lParam参数,否则内容来自于LB_SETITEMDATA消息的lParam
    {
        return SetItemData(GetHWND(), nIndex, str);
    }
    int GetItemHeight(int nIndex)//返回列表项中某一项的高度(像素);用于LBS_OWNERDRAWVARIABLE风格的,wParam指定的参数
    {
        return GetItemHeight(GetHWND(), nIndex);
    }
    /*Rect GetItemRect(int nIndex)//获得列表项的客户区RECT
    {
          GetItemRect(GetID(),nIndex);
    }*/
    int GetSel(int nIndex)//返回指定列表项的状态,如果查询的列表项被选择了返回一个正值,否则返回0
    {
        return GetSel(GetHWND(), nIndex);
    }
    int GetSelCount()//返回选择项的数目,仅用于多重选择列表框
    {
        return GetSelCount(GetHWND());
    }
    int GetSelItems()//获取选中项的数目和位置,仅用于多重选择列表框。wParam说明数组缓冲区的大小,lParam指向一个整型数组缓冲区
    {
        return GetSelItems(GetHWND());
    }
    string GetText(int nIndex) //返回文本
    {
        return GetText(GetHWND(), nIndex);
    }
    int GetTextLen(int nIndex) //返回当前选中项文本长度
    {
        GetTextLen(GetHWND(), nIndex);
    }
    int GetTopIndex() //第一个可见项的索引
    {
        return GetTopIndex(GetHWND());
    }
    int ResetCount()//清除所以列表项
    {
        return ResetCount(GetHWND());
    }
    int SelectString(int nIndex, string str) //选中从nIndex开始第一个str,返回选中的Index,只用在单选列表框中
    {
        return SelectString(GetHWND(), nIndex, str);
    }
    int SelItemRangeEx(int sIndex, int eIndex)//仅用于多重选择,从起点-终点
    {
        return SelItemRangeEx(GetHWND(), sIndex, eIndex);
    }
    int SetAnchorIndex(int nIndex)//设置鼠标最后选中的表项成指定表项
    {
        return SetAnchorIndex(GetHWND(), nIndex);
    }
    /*int SetCarerIndex(int nIndex,bool lParam)//设置键盘输入焦点到指定表项
    {
        return SetCarerIndex(GetHWND(),nIndex,lParam);
    }*/
    int SetColumnWidth(int nWidth)//设置多列列表框宽度,style为多列列表框时有效
    {
        return  SetColumnWidth(GetHWND(), nWidth);
    }
    int SetCount(int nCnt)//设置表项数目
    {
        return SetCount(GetHWND(), nCnt);
    }
    int SetCurSel(int nIndex)//设置指定列表项为当前选择项
    {
        return SetCurSel(GetHWND(), nIndex);
    }
    /*int SetSel( bool lbSel,int nIndex)//使指定的列表项选中或不选,用于多选中
    {
         return SetSel(lbSel, nIndex);
    }
    static bool SetTopIndex(int nIndex)//将指定的列表项设置为第一个可见项
    {
        return SetTopIndex(nIndex);
    }*/
    static int GetCount(HWND hWnd)//返回列表项总项数
    {
        int LB_GETCOUNT = 0x018B;
        return SendMessage(hWnd, LB_GETCOUNT, 0, 0);
    }
    static int AddItem(HWND hWnd, string str)//追加一个列表项,如果指定了LBS_SORT风格,将重排序,否则追加到最后
    {
        int LB_ADDSTRING = 0x0180;
        return SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM)str);
    }
    static int AddItem(HWND hWnd, string str, int p)//追加一个列表项,如果指定了LBS_SORT风格,将重排序,否则追加到最后
    {
        int LB_ADDSTRING = 0x0180;
        int nIndex = SendMessage(hWnd, LB_ADDSTRING, 0, (LPARAM)str);
        int LB_SETITEMDATA = 0x019A;
        SendMessage(hWnd, LB_SETITEMDATA, nIndex, p);
        return nIndex;
    }
    static int InsertItem(HWND hWnd, int nIndex, string str)//指定位置插入,wParam=-1添加到末尾。如果指定了LBS_SORT风格,则不会重排序,所以LBS_SORT风格下不用。
    {
        int LB_INSERTSTRING = 0x0181;
        return SendMessage(hWnd, LB_INSERTSTRING, nIndex, (LPARAM)str);
    }
    static int DeleteItem(HWND hWnd, int nIndex) //删除指定的列表项,lParam is not used
    {
        int LB_DELETESTRING = 0x0182;
        return SendMessage(hWnd, LB_DELETESTRING, nIndex, 0);
    }
    static int FindString(HWND hWnd, int nIndex, string str)//从指定开始表项序号开始查找指定项,忽略大小写,wParam=-1从第一项找
    {
        int LB_ERR = -1;
        int LB_FINDSTRING = 0x018F;
        int lResult = SendMessage(hWnd, LB_FINDSTRING, nIndex, (LPARAM)str);
        return lResult;
    }
    static int FindStringExact(HWND hWnd, int nIndex, string str)//整个字符串匹配
    {
        int LB_ERR = -1;
        int LB_FINDSTRINGEXACT = 0x01A2;
        int lResult = SendMessage(hWnd, LB_FINDSTRINGEXACT, nIndex, (LPARAM)str);
        return lResult;
    }
    static int GetAnchorIndex(HWND hWnd)//返回鼠标最后选中的项的索引
    {
        int LB_GETANCHORINDEX = 0x019D;
        return SendMessage(hWnd, LB_GETANCHORINDEX, 0, 0);
    }
    static int GetCaretIndex(HWND hWnd)//返回具有矩形焦点的项的索引
    {
        int LB_GETCARETINDEX = 0x019F;
        return SendMessage(hWnd, LB_GETCARETINDEX, 0, 0);
    }
    static int GetCurSel(HWND hWnd)//单选,返回当前被选中项索引
    {
        int LB_GETCURSEL = 0x0188;
        return SendMessage(hWnd, LB_GETCURSEL, 0, 0);
    }
    static int GetHorizon(HWND hWnd)//返回列表框可滚动的宽度(像素)
    {
        int LB_GETHORIZONTALEXTENT = 0x0193;
        return SendMessage(hWnd, LB_GETHORIZONTALEXTENT, 0, 0);
    }
    static int GetItemData(HWND hWnd, int nIndex)//返回指定列表项的附加数据;不是LBS_HASSTRINGS风格的,内容来自于LB_ADDSTRING或LB_INSERTSTRING消息的lParam参数,否则内容来自于LB_SETITEMDATA消息的lParam
    {
        int LB_GETITEMDATA = 0x0199;
        return SendMessage(hWnd, LB_GETITEMDATA, nIndex, 0);
    }
    static int SetItemData(HWND hWnd, int nIndex, int str)//返回指定列表项的附加数据;不是LBS_HASSTRINGS风格的,内容来自于LB_ADDSTRING或LB_INSERTSTRING消息的lParam参数,否则内容来自于LB_SETITEMDATA消息的lParam
    {
        int LB_SETITEMDATA = 0x019A;
        return SendMessage(hWnd, LB_SETITEMDATA, nIndex, str);
    }
    static int GetItemHeight(HWND hWnd, int nIndex)//返回列表项中某一项的高度(像素);用于LBS_OWNERDRAWVARIABLE风格的,wParam指定的参数
    {
        int LB_GETITEMHEIGHT = 0x01A1;
        return SendMessage(hWnd, LB_GETITEMHEIGHT, nIndex, 0);
    }
    /*static Rect GetItemRect(HWND hWnd,int nIndex)//获得列表项的客户区RECT
    {
          int LB_GETITEMRECT  = 0x0198;
          xrect rect;
          return SendMessage(hWnd,LB_GETITEMRECT,nIndex,rect);
    }*/
    static int GetSel(HWND hWnd, int nIndex)//返回指定列表项的状态,如果查询的列表项被选择了返回一个正值,否则返回0
    {
        int LB_GETSEL = 0x0187;
        return SendMessage(hWnd, LB_GETSEL, nIndex, 0);
    }
    static int GetSelCount(HWND hWnd)//返回选择项的数目,仅用于多重选择列表框
    {
        int LB_GETSELCOUNT = 0x0190;
        return SendMessage(hWnd, LB_GETSELCOUNT, 0, 0);
    }
    static int GetSelItems(HWND hWnd)//获取选中项的数目和位置,仅用于多重选择列表框。wParam说明数组缓冲区的大小,lParam指向一个整型数组缓冲区
    {
        int LB_GETSELITEMS = 0x0191;
        int nMax = GetSelCount(hWnd);
        int nItems;
        return SendMessage(hWnd, LB_GETSELITEMS, nMax, nItems);
    }
    static string GetText(HWND hWnd, int nIndex) //返回文本
    {
        int LB_GETTEXT = 0x0189;
        int LB_GETTEXTLEN = 0x018A;
        int nLen = SendMessage(hWnd, LB_GETTEXTLEN, nIndex, 0);
        string str = new wchar_t[nLen + 1];
        SendMessage(hWnd, LB_GETTEXT, nIndex, (LPARAM)str);
        return str;
    }
    static int GetTextLen(HWND hWnd, int nIndex) //返回当前选中项文本长度
    {
        int LB_GETTEXTLEN = 0x018A;
        return SendMessage(hWnd, LB_GETTEXTLEN, nIndex, 0);
    }
    static int GetTopIndex(HWND hWnd) //第一个可见项的索引
    {
        int LB_GETTOPINDEX = 0x018E;
        return SendMessage(hWnd, LB_GETTOPINDEX, 0, 0);
    }
    static int ResetCount(HWND hWnd)//清除所以列表项
    {
        int LB_RESETCONTENT = 0x0184;
        return SendMessage(hWnd, LB_RESETCONTENT, 0, 0);
    }
    static int SelectString(HWND hWnd, int nIndex, string str) //选中从nIndex开始第一个str,返回选中的Index,只用在单选列表框中
    {
        int LB_SELECTSTRING = 0x018C;
        return SendMessage(hWnd, LB_SELECTSTRING, nIndex, (LPARAM)str);
    }
    static int SelItemRangeEx(HWND hWnd, int sIndex, int eIndex)//仅用于多重选择,从起点-终点
    {
        int LB_SELITEMRANGEEX = 0x0183;
        return SendMessage(hWnd, LB_SELITEMRANGEEX, sIndex, eIndex);
    }
    static int SetAnchorIndex(HWND hWnd, int nIndex)//设置鼠标最后选中的表项成指定表项
    {
        int LB_SETANCHORINDEX = 0x019C;
        return SendMessage(hWnd, LB_SETANCHORINDEX, nIndex, 0);
    }
    /*static int SetCarerIndex(HWND hWnd,int nIndex,bool lParam)//设置键盘输入焦点到指定表项
    {
        int LB_SETCARETINDEX = 0x019E;
        return SendMessage(hWnd,LB_SETCARETINDEX,nIndex,lParam);
    }*/
    static int SetColumnWidth(HWND hWnd, int nWidth)//设置多列列表框宽度,style为多列列表框时有效
    {
        int LB_SETCOLUMNWIDTH = 0x0195;
        SendMessage(hWnd, LB_SETCOLUMNWIDTH, nWidth, 0);
        return 1;
    }
    static int SetCount(HWND hWnd, int nCnt)//设置表项数目
    {
        int LB_SETCOUNT = 0x01A7;
        SendMessage(hWnd, LB_SETCOUNT, nCnt, 0);
        return 1;
    }
    static int SetCurSel(HWND hWnd, int nIndex)//设置指定列表项为当前选择项
    {
        int LB_SETCURSEL = 0x0186;
        return SendMessage(hWnd, LB_SETCURSEL, nIndex, 0);//只用在单选列表框中。nIndex = -1为全不选
    }
    /*static int SetSel(HWND hWnd, bool lbSel,int nIndex)//使指定的列表项选中或不选,用于多选中
    {
          int LB_SETSEL  = 0x0185;
          return SendMessage(hWnd,LB_SETSEL,lbSel,nIndex);//用在多选中,wParm表示是否选,lParam为-1,选择所有
    }
    static bool SetTopIndex(HWND hWnd,int nIndex)//将指定的列表项设置为第一个可见项
    {
         int LB_SETTOPINDEX  = 0x0197;
         return SendMessage(hWnd,LB_SETTOPINDEX,nIndex,0);
    }*/
};
jrj/xframe/xcontrol/xlistview.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,533 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "win32/win.hpp"
typedef struct tagLVITEMW
{
    UINT mask;
    int iItem;
    int iSubItem;
    UINT state;
    UINT stateMask;
    LPWSTR pszText;
    int cchTextMax;
    int iImage;
    LPARAM lParam;
    int iIndent;
    int iGroupId;
    UINT cColumns; // tile view columns
    UINT* puColumns;
    int* piColFmt;
    int iGroup; // readonly. only valid for owner data.
} LVITEMW, * LPLVITEMW;
typedef struct tagLVCOLUMNW
{
    UINT mask;
    int fmt;
    int cx;
    LPWSTR pszText;
    int cchTextMax;
    int iSubItem;
    int iImage;
    int iOrder;
    int cxMin;       // min snap point
    int cxDefault;   // default snap point
    int cxIdeal;     // read only. ideal may not eqaul current width if auto sized (LVS_EX_AUTOSIZECOLUMNS_) to a lesser width.
} LVCOLUMNW, * LPLVCOLUMNW;
typedef struct tagLVFINDINFOW
{
    UINT flags;
    LPCWSTR psz;
    LPARAM lParam;
    POINT pt;
    UINT vkDirection;
} LVFINDINFOW, * LPFINDINFOW;
typedef LVITEMW lvitem;
typedef LVCOLUMNW lvcolumn;
typedef LVFINDINFOW lvfindinfo;
struct himagelist
{
};
struct imagelist
{
    himagelist hlist;
};
struct NMLISTVIEW : public NMHDR
{
    NMHDR   hdr;
    int     iItem;
    int     iSubItem;
    UINT    uNewState;
    UINT    uOldState;
    UINT    uChanged;
    POINT   ptAction;
    LPARAM  lParam;
};
class xlistview : public xcontrol
{
    static int SetdwStyle(HWND hWnd, int dwStyle)//设置风格
    {
        int GWL_STYLE_ = -16;
        int LVS_ICON_ = 0x0000;//大图标
        int LVS_REPORT_ = 0x0001;
        int LVS_SMALLICON_ = 0x0002;
        int LVS_LIST_ = 0x0003;//列表
        int IStyle =GetWindowLong(hWnd, GWL_STYLE_);
        int LVS_TYPEMASK_ = 0x0003;
        int LVS_EDITLABELS_ = 0x0200;
        IStyle &= ~LVS_TYPEMASK_;//清除显示方式位
        return SetWindowLong(hWnd, GWL_STYLE_, IStyle | dwStyle);
    }
    static int SetReportStyle(HWND hWnd)//设置Report风格
    {
        //获得原有风格
        int GWL_STYLE_ = -16;
        int IStyle = GetWindowLong(hWnd, GWL_STYLE_);
        int LVS_TYPEMASK_ = 0x0003;
        int LVS_EDITLABELS_ = 0x0200;
        IStyle &= ~LVS_TYPEMASK_;//清除显示方式位
        //设定一个新的窗口风格
        int LVS_REPORT_ = 0x0001;
        int LVS_NOLABELWRAP_ = 0x0080;
        int LVS_SHOWSELALWAYS_ = 0x0008;
        IStyle |= LVS_REPORT_;//设置style为report
        SetWindowLong(hWnd, GWL_STYLE_, IStyle | LVS_NOLABELWRAP_ | LVS_SHOWSELALWAYS_ | LVS_EDITLABELS_);
        //设置扩展风格
        int dwStyle;
        int LVM_FIRST_ = 0x1000;
        int LVM_GETEXTENDEDLISTVIEWSTYLE_ = LVM_FIRST_ + 55;
        dwStyle = SendMessage(hWnd, LVM_GETEXTENDEDLISTVIEWSTYLE_, 0, 0);//获取扩展风格
        int LVS_EX_FULLROWSELECT_ = 0x00000020;//整行选中, applies to report mode only
        int LVS_EX_GRIDLINES_ = 0x00000001; //网格线
        int LVS_EX_SUBITEMIMAGES_ = 0x00000002;//可以在列表中加ICON
        int LVS_EX_CHECKBOXES_ = 0x00000004;//前面加个checkbox
        dwStyle |= LVS_EX_FULLROWSELECT_ | LVS_EX_GRIDLINES_ | LVS_EX_CHECKBOXES_ | LVS_EX_SUBITEMIMAGES_;
        int LVM_SETEXTENDEDLISTVIEWSTYLE_ = LVM_FIRST_ + 54;
        return SendMessage(hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE_, dwStyle, dwStyle);
    }
    static int GetImageList(HWND hWnd, int iImageList)//ImageList
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETIMAGELIST_ = LVM_FIRST_ + 2;
        return SendMessage(hWnd, LVM_GETIMAGELIST_, iImageList, 0);
    }
    static int SetImageList(HWND hWnd, int iImageList, int himl)//设置ImageList
    {
        /*int LVSIL_NORMAL_ = 0;
        int LVSIL_SMALL_ = 1;
        int LVSIL_STATE_ = 2;*/
        int LVM_FIRST_ = 0x1000;
        int LVM_SETIMAGELIST_ = LVM_FIRST_ + 3;
        return SendMessage(hWnd, LVM_SETIMAGELIST_, iImageList, himl);
    }
    static int InsertColumn(HWND hWnd, int nCol, string label, int nFormat, int nWidth, int nSubItem)//增加列,加入列头
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_INSERTCOLUMN_ = LVM_FIRST_ + 97;
        int LVCF_FMT_ = 0x0001;//对齐方式:left,right
        int LVCF_WIDTH_ = 0x0002;//列宽度
        int LVCF_TEXT_ = 0x0004;//文本
        int LVCF_SUBITEM_ = 0x0008;//为分配给该列的列索引
        int LVCF_ORDER_ = 0x0020;//列偏移顺序从左到右
        int LVCFMT_LEFT_ = 0x0000;
        int LVCFMT_RIGHT_ = 0x0001;
        int LVCFMT_CENTER_ = 0x0002;
        lvcolumn lvc;
        lvc.mask = LVCF_FMT_ | LVCF_WIDTH_ | LVCF_TEXT_ | LVCF_SUBITEM_;//风格
        lvc.fmt = nFormat;
        xrect rect;
        //GetWindowRect(hWnd,rect);//取得窗口在屏幕坐标系下的RECT坐标(包括客户区和非客户区),这样可以得到窗口的大小和相对屏幕左上角(0,0)的位置。
        //GetClientRect;
        lvc.cx = nWidth;//(rect.right - rect.left ) * 3/5; //LVCF_WIDTH ï¼ŒWidth of the column, in pixels.
        lvc.pszText = (LPWSTR)label;//文字
        lvc.cchTextMax = 255;
        lvc.iSubItem = nSubItem;
        lvc.iImage = 0;
        lvc.iOrder = 0;
        return SendMessage(hWnd, LVM_INSERTCOLUMN_, nCol, (LPARAM) & lvc);
    }
    static int InsertItem(HWND hWnd, int xIndex, string label, int pictureindex = 0)//only the label and picture index need to be specified
    {
        int LVM_FIRST_ = 0x1000;// ListView messages
        int LVM_INSERTITEM_ = LVM_FIRST_ + 77;
        //LVITEM_mask
        //int LVIF_COLFMT
        //int LVIF_COLUMNS_ = 0x0200;
        int LVIF_DI_SETITEM_ = 0x1000;
        //int LVIF_GROUPID_ = 0x0100;
        int LVIF_IMAGE_ = 0x0002;
        //int LVIF_INDENT_ = 0x0010;
        //int LVIF_NORECOMPUTE_ = 0x0800;
        int LVIF_PARAM_ = 0x0004;
        int LVIF_STATE_ = 0x0008;
        int LVIF_TEXT_ = 0x0001;
        //LVITEM_state
        int LVIS_FOCUSED_ = 0x0001;
        int LVIS_SELECTED_ = 0x0002;
        int LVIS_OVERLAYMASK_ = 0x0F00;
        lvitem lvi;
        lvi.mask = LVIF_TEXT_ | LVIF_IMAGE_;
        lvi.iItem = xIndex; //指定插入项目的行号
        lvi.iSubItem = 0; //列号
        //lvi.state = LVIS_FOCUSED_ | LVIS_SELECTED_ | LVIS_OVERLAYMASK_;
        //lvi.stateMask = ;
        lvi.pszText = (LPWSTR)label;
        lvi.cchTextMax = 255;
        lvi.iImage = pictureindex;
        //lvi.lParam = data;
        //lvi.iIndent
        //int LVIF_GROUPID_ = 0x0100;
        //int I_GROUPIDCALLBACK_ = -1;
        //int I_GROUPIDNONE_ = -2;
        //int iGroupId = 1;
        //lvi.iGroupId = iGroupId;
        return SendMessage(hWnd, LVM_INSERTITEM_, 0, (LPARAM) & lvi);
    }
    static int InsertItemEx(HWND hWnd, int xIndex, string label, int pictureindex = 0, int data = 0)//only the label and picture index need to be specified
    {
        int LVM_FIRST_ = 0x1000;// ListView messages
        int LVM_INSERTITEM_ = LVM_FIRST_ + 77;
        //LVITEM_mask
        //int LVIF_COLFMT
        //int LVIF_COLUMNS_ = 0x0200;
        int LVIF_DI_SETITEM_ = 0x1000;
        //int LVIF_GROUPID_ = 0x0100;
        int LVIF_IMAGE_ = 0x0002;
        //int LVIF_INDENT_ = 0x0010;
        //int LVIF_NORECOMPUTE_ = 0x0800;
        int LVIF_PARAM_ = 0x0004;
        int LVIF_STATE_ = 0x0008;
        int LVIF_TEXT_ = 0x0001;
        //LVITEM_state
        int LVIS_FOCUSED_ = 0x0001;
        int LVIS_SELECTED_ = 0x0002;
        int LVIS_OVERLAYMASK_ = 0x0F00;
        lvitem lvi;
        lvi.mask = LVIF_TEXT_ | LVIF_IMAGE_ | LVIF_PARAM_;
        lvi.iItem = xIndex; //指定插入项目的行号
        lvi.iSubItem = 0; //列号
        //lvi.state = LVIS_FOCUSED_ | LVIS_SELECTED_ | LVIS_OVERLAYMASK_;
        //lvi.stateMask = ;
        lvi.pszText = (LPWSTR)label;
        lvi.cchTextMax = 255;
        lvi.iImage = pictureindex;
        lvi.lParam = data;
        //lvi.iIndent
        //int LVIF_GROUPID_ = 0x0100;
        //int I_GROUPIDCALLBACK_ = -1;
        //int I_GROUPIDNONE_ = -2;
        //int iGroupId = 1;
        //lvi.iGroupId = iGroupId;
        return SendMessage(hWnd, LVM_INSERTITEM_, 0, (LPARAM)&lvi);
    }
    static int SetItemText(HWND hWnd, int nItem, int nSubItem, string label)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_SETITEMTEXT_ = LVM_FIRST_ + 116;
        int LVIF_TEXT_ = 0x0001;
        lvitem lvi;
        lvi.mask = LVIF_TEXT_;
        lvi.iSubItem = nSubItem;
        lvi.pszText = (LPWSTR)label;
        lvi.cchTextMax = 255;
        return SendMessage(hWnd, LVM_SETITEMTEXT_, nItem, (LPARAM)&lvi);
    }
    static int DeleteItemAll(HWND hWnd)//删除所有
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_DELETEALLITEMS_ = LVM_FIRST_ + 9;
        return SendMessage(hWnd, LVM_DELETEALLITEMS_, 0, 0);
    }
    static int DeleteColumn(HWND hWnd, int nCol)//删除列
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_DELETECOLUMN_ = LVM_FIRST_ + 28;
        return SendMessage(hWnd, LVM_DELETECOLUMN_, nCol, 0);
    }
    static int DeleteItem(HWND hWnd, int nIndex)//删除行
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_DELETEITEM_ = LVM_FIRST_ + 8;
        return SendMessage(hWnd, LVM_DELETEITEM_, nIndex, 0);
    }
    static int EditLabel(HWND hWnd, int nIndex)//nIndex= -1表示取消编辑
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_EDITLABEL_ = LVM_FIRST_ + 118;
        return SendMessage(hWnd, LVM_EDITLABEL_, nIndex, 0);
    }
    static int FindItem(HWND hWnd, int iStart, string label, bool partial, bool wrap)
    {
        //FindItem( int iStart, string label, boolean partial,boolean wrap )
            //partial=true搜素包含label开头的,=false必须匹配整个标签
            //wrap =true返回第一个找到的,=false返回最后找到的
        int LVM_FIRST_ = 0x1000;
        int LVM_FINDITEM_ = LVM_FIRST_ + 83;
        //flags
        int LVFI_PARAM_ = 0x0001;
        int LVFI_STRING_ = 0x0002;
        int LVFI_PARTIAL_ = 0x0008;
        int LVFI_WRAP_ = 0x0020;
        int LVFI_NEARESTXY_ = 0x0040;
        //vkDirection
        int VK_PRIOR_ = 0x21;
        int VK_NEXT_ = 0x22;
        int VK_END_ = 0x23;
        int VK_HOME_ = 0x24;
        int VK_LEFT_ = 0x25;
        int VK_UP = 0x26;
        int VK_RIGHT_ = 0x27;
        int VK_DOWN_ = 0x28;
        lvfindinfo lvfi;
        if (partial == true)
        {
            lvfi.flags = LVFI_PARTIAL_ | LVFI_STRING_;
        }
        else
            lvfi.flags = LVFI_STRING_;
        if (wrap == true)
        {
            lvfi.flags |= LVFI_WRAP_;
        }
        lvfi.psz = label;
        //lvfi.lParam = //为LVFI_PARAM时有效
        //lvfi.pt //初始搜索位置,为LVFI_NEARESTXY æ—¶æœ‰æ•ˆ
        //lvfi.vkDirection = VK_NEXT_; //搜素方向。This member is valid only if LVFI_NEARESTXY is set in the flags member
        return SendMessage(hWnd, LVM_FINDITEM_, iStart, (LPARAM)&lvfi);
    }
    static int GetColumn(HWND hWnd, int iCol, lvcolumn lvc)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETCOLUMN_ = LVM_FIRST_ + 95;
        return SendMessage(hWnd, LVM_GETCOLUMN_, iCol, (LPARAM)&lvc);
    }
    static int GetItem(HWND hWnd, lvitem& lvi)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETITEM_ = LVM_FIRST_ + 75;
        return SendMessage(hWnd, LVM_GETITEM_, 0, (LPARAM)&lvi);
    }
    static int GetItemCount(HWND hWnd)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETITEMCOUNT_ = LVM_FIRST_ + 4;
        return SendMessage(hWnd, LVM_GETITEMCOUNT_, 0, 0);
    }
    static int GetItemText(HWND hWnd, int nIndex, lvitem lvi)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETITEMTEXT_ = LVM_FIRST_ + 115;
        return SendMessage(hWnd, LVM_GETITEMTEXT_, nIndex, (LPARAM)&lvi);
    }
    static int GetNextItem(HWND hWnd, int nIndex, int flags)//nIndex=-1时从第一个开始
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETNEXTITEM_ = LVM_FIRST_ + 12;
        return SendMessage(hWnd, LVM_GETNEXTITEM_, nIndex, flags);
    }
    static int GetSelectColumn(HWND hWnd)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETSELECTEDCOLUMN_ = LVM_FIRST_ + 174;
        return SendMessage(hWnd, LVM_GETSELECTEDCOLUMN_, 0, 0);
    }
    static int GetSelectCount(HWND hWnd)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETSELECTEDCOUNT_ = LVM_FIRST_ + 50;
        return SendMessage(hWnd, LVM_GETSELECTEDCOUNT_, 0, 0);
    }
    static int SetColumn(HWND hWnd, int iCol, lvcolumn lvc)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_SETCOLUMN_ = LVM_FIRST_ + 96;
        return SendMessage(hWnd, LVM_SETCOLUMN_, iCol, (LPARAM)&lvc);
    }
    static int SetItem(HWND hWnd, lvitem lvi)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_SETITEM_ = LVM_FIRST_ + 76;
        return SendMessage(hWnd, LVM_SETITEM_, 0, (LPARAM)&lvi);
    }
    static int SetItemText(HWND hWnd, int nIndex, lvitem lvi)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_SETITEMTEXT_ = LVM_FIRST_ + 116;
        return SendMessage(hWnd, LVM_SETITEMTEXT_, nIndex, (LPARAM)&lvi);
    }
    static int InsertColumn(HWND hWnd, int nCol, int nFormat, int nWidth, string label, int nSubItem)//增加列
    {
        lvcolumn lvc;     // åˆ—
        // ZeroMemory(&lvc, sizeof(lvcolumn));
        int LVCF_FMT_ = 0x0001;
        int LVCF_WIDTH_ = 0x0002;
        int LVCF_TEXT_ = 0x0004;
        int LVCF_SUBITEM_ = 0x0008;
        int LVCFMT_LEFT_ = 0x0000;
        lvc.mask = LVCF_FMT_ | LVCF_TEXT_ | LVCF_WIDTH_ | LVCF_SUBITEM_; // é£Žæ ¼
        lvc.fmt = nFormat;//文本左对齐
        lvc.cx = nWidth;         // cx æ˜¯åˆ—的宽度(以像素点为单位)。以后您可以发送消息LVM_SETCOLUMNWIDTH æ¥æ”¹å˜åˆ—的宽度。
        lvc.pszText = (LPWSTR)label; // æ–‡å­—
        lvc.cchTextMax = 255;       // æ–‡å­—长度
        lvc.iSubItem = nSubItem;         // åˆ—号
        int LVM_FIRST_ = 0x1000;// ListView messages
        int LVM_INSERTCOLUMN_ = LVM_FIRST_ + 97;
        return SendMessage(hWnd, LVM_INSERTCOLUMN_, nCol, (LPARAM)&lvc);
        //lvc.pszText = "内存使用";
        //SendMessage(hWnd, LVM_INSERTCOLUMN_, 0, (LPARAM_)&lvc);
        //lvc.pszText = "ID";
        //SendMessage(hWnd, LVM_INSERTCOLUMN_, 0, (LPARAM_)&lvc);
    }
    static int InsertItem(HWND hWnd, int nItem, int nSubItem, string label, int pictureindex)//增加行
    {
        lvitem lvi;     // åˆ—
        // ZeroMemory(&lvi, sizeof(lvitem));
        int LVIF_TEXT_ = 0x0001;
        int LVIF_IMAGE_ = 0x0002;
        int LVIF_PARAM_ = 0x0004;
        int LVIF_STATE_ = 0x0008;
        int MAX_PATH_ = 255;
        int LVIS_STATEIMAGEMASK_ = 0xF000;
        int LVIS_FOCUSED_ = 0x0001;
        int LVIS_SELECTED_ = 0x0002;
        lvi.mask = LVIF_TEXT_ | LVIF_IMAGE_ | LVIF_STATE_ | LVIF_PARAM_; // æ–‡å­—、图片// æŽ©ç ä½çš„组合(下面有对应掩码的元素都已在括号中标出掩码),表明哪些元素是有效的
        lvi.iItem = nItem; //行号
        lvi.iSubItem = nSubItem;  //列号
        lvi.pszText = (LPWSTR)label;
        lvi.cchTextMax = 255;       // æ–‡å­—长度
        lvi.iImage = pictureindex;
        lvi.state = LVIS_FOCUSED_;  // çŠ¶æ€ï¼Œä¸‹é¢ä¼šåˆ—å‡ºã€‚ï¼ˆLVIF_STATE)
        lvi.stateMask = LVIS_STATEIMAGEMASK_;// çŠ¶æ€æŽ©ç ï¼Œç”¨æ¥è¯´æ˜Žè¦èŽ·å–æˆ–è®¾ç½®å“ªäº›çŠ¶æ€ã€‚
        int LVM_FIRST_ = 0x1000;// ListView messages
        int LVM_INSERTITEM_ = LVM_FIRST_ + 77;
        return SendMessage(hWnd, LVM_INSERTITEM_, 0, (LPARAM)&lvi);
        //lvi.pszText = "日本";
        //SendMessage(hWnd, LVM_INSERTITEM_, 0, (LPARAM_)&lvi);
        //lvi.pszText = "德国";
        //SendMessage(hWnd, LVM_INSERTITEM_, 0, (LPARAM_)&lvi);
    }
    static string GetItemText(HWND hWnd, int nIndex)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_GETITEMTEXT_ = LVM_FIRST_ + 115;
        int LVIF_TEXT_ = 0x0001;
        lvitem lvi;
        lvi.mask = LVIF_TEXT_;
        lvi.iItem = nIndex;
        lvi.pszText = new wchar_t[255];
        lvi.cchTextMax = 255;
        int ret = SendMessage(hWnd, LVM_GETITEMTEXT_, nIndex, (LPARAM)&lvi);
        //trace("result: %s", ret.toString());
        return lvi.pszText;
    }
    /*static int AddItem(HWND hWnd,string label, int pictureindex = 0) //名字和图片
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_INSERTITEM_ = LVM_FIRST_ + 77;
        lvitem pitem;
        pitem.iItem = 0;
        pitem.iSubItem = 0;
        pitem.pszText = label;
        pitem.iImage = pictureindex;
        return win__::SendMessage(hWnd, LVM_INSERTITEM_, 0, &pitem);
    }
    static int AddItem(HWND hWnd,lvitem hItem)
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_INSERTITEM_ = LVM_FIRST_ + 77;
        return win__::SendMessage(hWnd, LVM_INSERTITEM_, 0, &hItem);
    }
    static int InsertItem(HWND hWnd,int nIndex,lvitem hItem )//more than the label and picture index need to be specified
    {
        int LVM_FIRST_ = 0x1000;
        int LVM_INSERTITEM_ = LVM_FIRST_ + 77;
        return win__::SendMessage(hWnd, LVM_INSERTITEM_, 0, &hItem);
    }
    static int Sort (HWND hWnd,int hItem ,string sorttype )
    {
    }
    //-------
    static int AddLargePicture()
    {
    }
    static int AddStatePicture()
    {
    }
    static int DeleteLargePicture(int nIndex)
    {
    }
    static int DeleteLargePictures()
    {
    }
    static int DeleteStatePictures()
    {
    }
    static int Drag ()
    {
    //dragmode = Begin!,Cancel!,End!
    }
    static int SetColumn (HWND hWnd,int nIndex,string label,string alignment,int width )
    {
    }*/
};