比如说 我想选中10个item里面的第三个
我只想用sendmessage 其他方法不要
10 个解决方案
#1
其实用这个方法就可以
dim I as listitem
set i=listview1.listitem(3)
i.selected=true
不过你一定要用sendmessage()的话,很简单,你用spy++来跟踪一下就可以知道了嘛!
dim I as listitem
set i=listview1.listitem(3)
i.selected=true
不过你一定要用sendmessage()的话,很简单,你用spy++来跟踪一下就可以知道了嘛!
#2
谢谢你的回答!
我想用自己的程序选中另外一个程序 listview 里面的item
syp++ 没用过 我先试着用一下
我想用自己的程序选中另外一个程序 listview 里面的item
syp++ 没用过 我先试着用一下
#3
Private Sub Check2_Click()
Dim rStyle As Long
Dim r As Long
'get the current ListView style
rStyle = SendMessageLong(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
If Check2.Value = 0 Then 'remove the extended style bit
rStyle = rStyle Xor LVS_EX_FULLROWSELECT
ElseIf Check2.Value = 1 Then
'set the extended style bit
rStyle = rStyle Or LVS_EX_FULLROWSELECT
End If
'set the new ListView style
r = SendMessageLong(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
End Sub
Dim rStyle As Long
Dim r As Long
'get the current ListView style
rStyle = SendMessageLong(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
If Check2.Value = 0 Then 'remove the extended style bit
rStyle = rStyle Xor LVS_EX_FULLROWSELECT
ElseIf Check2.Value = 1 Then
'set the extended style bit
rStyle = rStyle Or LVS_EX_FULLROWSELECT
End If
'set the new ListView style
r = SendMessageLong(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
End Sub
#4
Public Const LVM_FIRST = &H1000
Public Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Public Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Public Const LVS_EX_FULLROWSELECT = &H20
你试试吧
Public Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Public Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Public Const LVS_EX_FULLROWSELECT = &H20
你试试吧
#5
谢谢 我试过了
按照你的方法出现的是另外一种效果
而不是我希望得到的 我希望选中10个item 里面的第三个 或第四个
再次感谢 希望大家多帮忙
按照你的方法出现的是另外一种效果
而不是我希望得到的 我希望选中10个item 里面的第三个 或第四个
再次感谢 希望大家多帮忙
#6
Public Function ListView_SetItemState(hwndLV As Long, i As Long, state As LVITEM_state, mask As LVITEM_state) As Boolean
Dim lvi As LVITEM
lvi.state = LVIS_SELECTED
lvi.stateMask = mask
ListView_SetItemState = SendMessage(hwndLV, LVM_SETITEMSTATE, ByVal 3, lvi)
End Function
Dim lvi As LVITEM
lvi.state = LVIS_SELECTED
lvi.stateMask = mask
ListView_SetItemState = SendMessage(hwndLV, LVM_SETITEMSTATE, ByVal 3, lvi)
End Function
#7
能不能 把自定义变量 还有常数的值写出来
我在搜索引擎上根本找不到
我在搜索引擎上根本找不到
#8
Public Enum TVMessages
TV_FIRST = &H1100
#If UNICODE Then
TVM_INSERTITEM = (TV_FIRST + 50)
#Else
TVM_INSERTITEM = (TV_FIRST + 0)
#End If
TVM_DELETEITEM = (TV_FIRST + 1)
TVM_EXPAND = (TV_FIRST + 2)
TVM_GETITEMRECT = (TV_FIRST + 4)
TVM_GETCOUNT = (TV_FIRST + 5)
TVM_GETINDENT = (TV_FIRST + 6)
TVM_SETINDENT = (TV_FIRST + 7)
TVM_GETIMAGELIST = (TV_FIRST + 8)
TVM_SETIMAGELIST = (TV_FIRST + 9)
TVM_GETNEXTITEM = (TV_FIRST + 10)
TVM_SELECTITEM = (TV_FIRST + 11)
#If UNICODE Then
TVM_GETITEM = (TV_FIRST + 62)
TVM_SETITEM = (TV_FIRST + 63)
TVM_EDITLABEL = (TV_FIRST + 65)
#Else
TVM_GETITEM = (TV_FIRST + 12)
TVM_SETITEM = (TV_FIRST + 13)
TVM_EDITLABEL = (TV_FIRST + 14)
#End If
TVM_GETEDITCONTROL = (TV_FIRST + 15)
TVM_GETVISIBLECOUNT = (TV_FIRST + 16)
TVM_HITTEST = (TV_FIRST + 17)
TVM_CREATEDRAGIMAGE = (TV_FIRST + 18)
TVM_SORTCHILDREN = (TV_FIRST + 19)
TVM_ENSUREVISIBLE = (TV_FIRST + 20)
TVM_SORTCHILDRENCB = (TV_FIRST + 21)
TVM_ENDEDITLABELNOW = (TV_FIRST + 22)
#If UNICODE Then
TVM_GETISEARCHSTRING = (TV_FIRST + 64)
#Else
TVM_GETISEARCHSTRING = (TV_FIRST + 23)
#End If
TVM_SETTOOLTIPS = (TV_FIRST + 24)
TVM_GETTOOLTIPS = (TV_FIRST + 25)
End Enum ' TVMessages
Public Enum TVM_EXPAND_wParam
TVE_COLLAPSE = &H1
TVE_EXPAND = &H2
TVE_TOGGLE = &H3
TVE_EXPANDPARTIAL = &H4000
TVE_COLLAPSERESET = &H8000
End Enum
Public Enum TVM_GETNEXTITEM_wParam
TVGN_ROOT = &H0
TVGN_NEXT = &H1
TVGN_PREVIOUS = &H2
TVGN_PARENT = &H3
TVGN_CHILD = &H4
TVGN_FIRSTVISIBLE = &H5
TVGN_NEXTVISIBLE = &H6
TVGN_PREVIOUSVISIBLE = &H7
TVGN_DROPHILITE = &H8
TVGN_CARET = &H9
End Enum
http://www.800down.com/view.asp?id=1786
http://www.onlinedown.net/soft/16780.htm
我编了一个软件叫注册表大师,你下载看看你想实现的是不是其中的定位功能那样。
TV_FIRST = &H1100
#If UNICODE Then
TVM_INSERTITEM = (TV_FIRST + 50)
#Else
TVM_INSERTITEM = (TV_FIRST + 0)
#End If
TVM_DELETEITEM = (TV_FIRST + 1)
TVM_EXPAND = (TV_FIRST + 2)
TVM_GETITEMRECT = (TV_FIRST + 4)
TVM_GETCOUNT = (TV_FIRST + 5)
TVM_GETINDENT = (TV_FIRST + 6)
TVM_SETINDENT = (TV_FIRST + 7)
TVM_GETIMAGELIST = (TV_FIRST + 8)
TVM_SETIMAGELIST = (TV_FIRST + 9)
TVM_GETNEXTITEM = (TV_FIRST + 10)
TVM_SELECTITEM = (TV_FIRST + 11)
#If UNICODE Then
TVM_GETITEM = (TV_FIRST + 62)
TVM_SETITEM = (TV_FIRST + 63)
TVM_EDITLABEL = (TV_FIRST + 65)
#Else
TVM_GETITEM = (TV_FIRST + 12)
TVM_SETITEM = (TV_FIRST + 13)
TVM_EDITLABEL = (TV_FIRST + 14)
#End If
TVM_GETEDITCONTROL = (TV_FIRST + 15)
TVM_GETVISIBLECOUNT = (TV_FIRST + 16)
TVM_HITTEST = (TV_FIRST + 17)
TVM_CREATEDRAGIMAGE = (TV_FIRST + 18)
TVM_SORTCHILDREN = (TV_FIRST + 19)
TVM_ENSUREVISIBLE = (TV_FIRST + 20)
TVM_SORTCHILDRENCB = (TV_FIRST + 21)
TVM_ENDEDITLABELNOW = (TV_FIRST + 22)
#If UNICODE Then
TVM_GETISEARCHSTRING = (TV_FIRST + 64)
#Else
TVM_GETISEARCHSTRING = (TV_FIRST + 23)
#End If
TVM_SETTOOLTIPS = (TV_FIRST + 24)
TVM_GETTOOLTIPS = (TV_FIRST + 25)
End Enum ' TVMessages
Public Enum TVM_EXPAND_wParam
TVE_COLLAPSE = &H1
TVE_EXPAND = &H2
TVE_TOGGLE = &H3
TVE_EXPANDPARTIAL = &H4000
TVE_COLLAPSERESET = &H8000
End Enum
Public Enum TVM_GETNEXTITEM_wParam
TVGN_ROOT = &H0
TVGN_NEXT = &H1
TVGN_PREVIOUS = &H2
TVGN_PARENT = &H3
TVGN_CHILD = &H4
TVGN_FIRSTVISIBLE = &H5
TVGN_NEXTVISIBLE = &H6
TVGN_PREVIOUSVISIBLE = &H7
TVGN_DROPHILITE = &H8
TVGN_CARET = &H9
End Enum
http://www.800down.com/view.asp?id=1786
http://www.onlinedown.net/soft/16780.htm
我编了一个软件叫注册表大师,你下载看看你想实现的是不是其中的定位功能那样。
#9
LV_……是ListView专用消息
#10
我希望得到 回复人:bbe() 提供的函数里面的 自定义变量 和 常数
谢谢大家帮忙
谢谢大家帮忙
#1
其实用这个方法就可以
dim I as listitem
set i=listview1.listitem(3)
i.selected=true
不过你一定要用sendmessage()的话,很简单,你用spy++来跟踪一下就可以知道了嘛!
dim I as listitem
set i=listview1.listitem(3)
i.selected=true
不过你一定要用sendmessage()的话,很简单,你用spy++来跟踪一下就可以知道了嘛!
#2
谢谢你的回答!
我想用自己的程序选中另外一个程序 listview 里面的item
syp++ 没用过 我先试着用一下
我想用自己的程序选中另外一个程序 listview 里面的item
syp++ 没用过 我先试着用一下
#3
Private Sub Check2_Click()
Dim rStyle As Long
Dim r As Long
'get the current ListView style
rStyle = SendMessageLong(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
If Check2.Value = 0 Then 'remove the extended style bit
rStyle = rStyle Xor LVS_EX_FULLROWSELECT
ElseIf Check2.Value = 1 Then
'set the extended style bit
rStyle = rStyle Or LVS_EX_FULLROWSELECT
End If
'set the new ListView style
r = SendMessageLong(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
End Sub
Dim rStyle As Long
Dim r As Long
'get the current ListView style
rStyle = SendMessageLong(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, 0&)
If Check2.Value = 0 Then 'remove the extended style bit
rStyle = rStyle Xor LVS_EX_FULLROWSELECT
ElseIf Check2.Value = 1 Then
'set the extended style bit
rStyle = rStyle Or LVS_EX_FULLROWSELECT
End If
'set the new ListView style
r = SendMessageLong(ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, rStyle)
End Sub
#4
Public Const LVM_FIRST = &H1000
Public Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Public Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Public Const LVS_EX_FULLROWSELECT = &H20
你试试吧
Public Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Public Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Public Const LVS_EX_FULLROWSELECT = &H20
你试试吧
#5
谢谢 我试过了
按照你的方法出现的是另外一种效果
而不是我希望得到的 我希望选中10个item 里面的第三个 或第四个
再次感谢 希望大家多帮忙
按照你的方法出现的是另外一种效果
而不是我希望得到的 我希望选中10个item 里面的第三个 或第四个
再次感谢 希望大家多帮忙
#6
Public Function ListView_SetItemState(hwndLV As Long, i As Long, state As LVITEM_state, mask As LVITEM_state) As Boolean
Dim lvi As LVITEM
lvi.state = LVIS_SELECTED
lvi.stateMask = mask
ListView_SetItemState = SendMessage(hwndLV, LVM_SETITEMSTATE, ByVal 3, lvi)
End Function
Dim lvi As LVITEM
lvi.state = LVIS_SELECTED
lvi.stateMask = mask
ListView_SetItemState = SendMessage(hwndLV, LVM_SETITEMSTATE, ByVal 3, lvi)
End Function
#7
能不能 把自定义变量 还有常数的值写出来
我在搜索引擎上根本找不到
我在搜索引擎上根本找不到
#8
Public Enum TVMessages
TV_FIRST = &H1100
#If UNICODE Then
TVM_INSERTITEM = (TV_FIRST + 50)
#Else
TVM_INSERTITEM = (TV_FIRST + 0)
#End If
TVM_DELETEITEM = (TV_FIRST + 1)
TVM_EXPAND = (TV_FIRST + 2)
TVM_GETITEMRECT = (TV_FIRST + 4)
TVM_GETCOUNT = (TV_FIRST + 5)
TVM_GETINDENT = (TV_FIRST + 6)
TVM_SETINDENT = (TV_FIRST + 7)
TVM_GETIMAGELIST = (TV_FIRST + 8)
TVM_SETIMAGELIST = (TV_FIRST + 9)
TVM_GETNEXTITEM = (TV_FIRST + 10)
TVM_SELECTITEM = (TV_FIRST + 11)
#If UNICODE Then
TVM_GETITEM = (TV_FIRST + 62)
TVM_SETITEM = (TV_FIRST + 63)
TVM_EDITLABEL = (TV_FIRST + 65)
#Else
TVM_GETITEM = (TV_FIRST + 12)
TVM_SETITEM = (TV_FIRST + 13)
TVM_EDITLABEL = (TV_FIRST + 14)
#End If
TVM_GETEDITCONTROL = (TV_FIRST + 15)
TVM_GETVISIBLECOUNT = (TV_FIRST + 16)
TVM_HITTEST = (TV_FIRST + 17)
TVM_CREATEDRAGIMAGE = (TV_FIRST + 18)
TVM_SORTCHILDREN = (TV_FIRST + 19)
TVM_ENSUREVISIBLE = (TV_FIRST + 20)
TVM_SORTCHILDRENCB = (TV_FIRST + 21)
TVM_ENDEDITLABELNOW = (TV_FIRST + 22)
#If UNICODE Then
TVM_GETISEARCHSTRING = (TV_FIRST + 64)
#Else
TVM_GETISEARCHSTRING = (TV_FIRST + 23)
#End If
TVM_SETTOOLTIPS = (TV_FIRST + 24)
TVM_GETTOOLTIPS = (TV_FIRST + 25)
End Enum ' TVMessages
Public Enum TVM_EXPAND_wParam
TVE_COLLAPSE = &H1
TVE_EXPAND = &H2
TVE_TOGGLE = &H3
TVE_EXPANDPARTIAL = &H4000
TVE_COLLAPSERESET = &H8000
End Enum
Public Enum TVM_GETNEXTITEM_wParam
TVGN_ROOT = &H0
TVGN_NEXT = &H1
TVGN_PREVIOUS = &H2
TVGN_PARENT = &H3
TVGN_CHILD = &H4
TVGN_FIRSTVISIBLE = &H5
TVGN_NEXTVISIBLE = &H6
TVGN_PREVIOUSVISIBLE = &H7
TVGN_DROPHILITE = &H8
TVGN_CARET = &H9
End Enum
http://www.800down.com/view.asp?id=1786
http://www.onlinedown.net/soft/16780.htm
我编了一个软件叫注册表大师,你下载看看你想实现的是不是其中的定位功能那样。
TV_FIRST = &H1100
#If UNICODE Then
TVM_INSERTITEM = (TV_FIRST + 50)
#Else
TVM_INSERTITEM = (TV_FIRST + 0)
#End If
TVM_DELETEITEM = (TV_FIRST + 1)
TVM_EXPAND = (TV_FIRST + 2)
TVM_GETITEMRECT = (TV_FIRST + 4)
TVM_GETCOUNT = (TV_FIRST + 5)
TVM_GETINDENT = (TV_FIRST + 6)
TVM_SETINDENT = (TV_FIRST + 7)
TVM_GETIMAGELIST = (TV_FIRST + 8)
TVM_SETIMAGELIST = (TV_FIRST + 9)
TVM_GETNEXTITEM = (TV_FIRST + 10)
TVM_SELECTITEM = (TV_FIRST + 11)
#If UNICODE Then
TVM_GETITEM = (TV_FIRST + 62)
TVM_SETITEM = (TV_FIRST + 63)
TVM_EDITLABEL = (TV_FIRST + 65)
#Else
TVM_GETITEM = (TV_FIRST + 12)
TVM_SETITEM = (TV_FIRST + 13)
TVM_EDITLABEL = (TV_FIRST + 14)
#End If
TVM_GETEDITCONTROL = (TV_FIRST + 15)
TVM_GETVISIBLECOUNT = (TV_FIRST + 16)
TVM_HITTEST = (TV_FIRST + 17)
TVM_CREATEDRAGIMAGE = (TV_FIRST + 18)
TVM_SORTCHILDREN = (TV_FIRST + 19)
TVM_ENSUREVISIBLE = (TV_FIRST + 20)
TVM_SORTCHILDRENCB = (TV_FIRST + 21)
TVM_ENDEDITLABELNOW = (TV_FIRST + 22)
#If UNICODE Then
TVM_GETISEARCHSTRING = (TV_FIRST + 64)
#Else
TVM_GETISEARCHSTRING = (TV_FIRST + 23)
#End If
TVM_SETTOOLTIPS = (TV_FIRST + 24)
TVM_GETTOOLTIPS = (TV_FIRST + 25)
End Enum ' TVMessages
Public Enum TVM_EXPAND_wParam
TVE_COLLAPSE = &H1
TVE_EXPAND = &H2
TVE_TOGGLE = &H3
TVE_EXPANDPARTIAL = &H4000
TVE_COLLAPSERESET = &H8000
End Enum
Public Enum TVM_GETNEXTITEM_wParam
TVGN_ROOT = &H0
TVGN_NEXT = &H1
TVGN_PREVIOUS = &H2
TVGN_PARENT = &H3
TVGN_CHILD = &H4
TVGN_FIRSTVISIBLE = &H5
TVGN_NEXTVISIBLE = &H6
TVGN_PREVIOUSVISIBLE = &H7
TVGN_DROPHILITE = &H8
TVGN_CARET = &H9
End Enum
http://www.800down.com/view.asp?id=1786
http://www.onlinedown.net/soft/16780.htm
我编了一个软件叫注册表大师,你下载看看你想实现的是不是其中的定位功能那样。
#9
LV_……是ListView专用消息
#10
我希望得到 回复人:bbe() 提供的函数里面的 自定义变量 和 常数
谢谢大家帮忙
谢谢大家帮忙