VB 使用SendMessage获取外部程序的listView内容 50
ListCount=SendMessage(hwnd,LVM_GETITEMCOUNT,0,0)ItemText=SendMessage(hlist,LVM_GETITE...
ListCount = SendMessage(hwnd, LVM_GETITEMCOUNT, 0, 0)
ItemText=SendMessage(hlist, LVM_GETITEMTEXT, 0,0)
ListCount能正常获取行数,但是获取ItemText就出错 展开
ItemText=SendMessage(hlist, LVM_GETITEMTEXT, 0,0)
ListCount能正常获取行数,但是获取ItemText就出错 展开
1个回答
展开全部
'获取控件的内容Option ExplicitPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As LongPrivate Const WM_GETTEXT = HDPrivate Const WM_GETTEXTLENGTH = HEPublic Function GetTextString(ByVal lyHwnd As Long) As String Dim GetS As String Dim SLen As Long SLen = SendMessage(lyHwnd, WM_GETTEXTLENGTH, 0, 0) If SLen = 0 Then Exit Function SLen = SLen + 1 GetS = Space(SLen) SLen = SendMessage(lyHwnd, WM_GETTEXT, SLen, ByVal GetS) GetTextString = Left(GetS, SLen)End Function 控件的句柄你应该能获取到,所以不说了
追问
我需要的是listView控件的内容,能否做个例子??
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询