关于VB中LISTBOX数据提取
大家好,不知道大家有没有发现,我们把数据加到LISTBOX里时可以添加10几万组数据或更多,可为什么我想再从里面提取值出来只能提取65535组数据?有没有什么方法可以一次全部提取出来,谢谢
程序代码:
'┏〓〓〓〓〓〓〓〓〓 GetAllListItem,start 〓〓〓〓〓〓〓〓〓┓ '[简介]: 'API方式获取所有LISTBOX的项目值 Function GetAllListItem(Hwnd1 As Long) 'VB源码,帮你写函数,帮你写代码,帮你写模块,帮你设计软件 '--需要什么函数或功能,可以联系我。 '版权所有,请保留作者信息.QQ:2605961812 '如需商业用途请联系作者 Dim Counts As Long, UB As Long Counts = SendMessage(Hwnd1, LB_GETCOUNT, 0, 0) If Counts = 0 Then Exit Function Dim Sz UB = Counts - 1 ReDim Sz(UB) Dim S As String Dim ListIndex As Long For ListIndex = 0 To UB S = String$(255, 0) SendMessageByString& Hwnd1, LB_GETTEXT, ListIndex, S S = Left$(S, InStr(1, S, Chr$(0)) - 1) Sz(ListIndex) = S Next GetAllListItem = Sz End Function '┗〓〓〓〓〓〓〓〓〓 GetAllListItem,end 〓〓〓〓〓〓〓〓〓┛
API 定义:
程序代码:
Private Const LB_GETTEXT = &H189 Private Const LB_GETCOUNT = &H18B Private Declare Function SendMessageBynum& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) Private Declare Function SendMessageByString& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String)