找回密码
 加入
搜索
查看: 4262|回复: 4

[系统综合] ListView复选框响应问题,已解决,但不明白为什么

[复制链接]
发表于 2015-3-17 17:23:09 | 显示全部楼层 |阅读模式
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

Local $listview1, $button, $item1, $item2, $item3, $msg

GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color

$listview1 = GUICtrlCreateListView("col1  |col2|col3  ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
$item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview1)
$item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview1)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview1)
GUICtrlCreateInput("", 20, 200, 150)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
GUISetState()
GUICtrlSetData($item2, "ITEM1")
GUICtrlSetData($item3, "||COL33")
GUICtrlDelete($item1)
Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)
_GUICtrlListView_SetExtendedListViewStyle($listview1, $exStyles)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
        Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $List
        $hWndListView = $ListView1
        If Not IsHWnd($ListView1) Then $hWndListView = GUICtrlGetHandle($ListView1)

        $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
        $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
        $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
        $iCode = DllStructGetData($tNMHDR, "Code")
        Switch $hWndFrom
                Case $hWndListView
                        ;ConsoleWrite("ICODE:"&$iCode&@CR)
                        Switch $iCode
                                Case -189
                                MsgBox(0, '', '你拉勾勾了')
                                Case $NM_RCLICK
                                        ConsoleWrite("Right click at listview")
                                        ;ListView_RClick()
                                        Return 0

                                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                                        Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                                        $Index = DllStructGetData($tInfo, "Index")
                                        $subitemNR = DllStructGetData($tInfo, "SubItem")
                                        ConsoleWrite("Double click at item index: " & $Index & @CRLF)
                        EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY
发表于 2015-6-10 01:11:44 | 显示全部楼层
找了好久,终于解决我的问题了,感谢楼主,非常感谢!!!!
发表于 2016-1-6 10:43:19 | 显示全部楼层
ListView复选框响应问题,做个记号,如果是事件响应就好了
发表于 2017-6-21 17:52:26 | 显示全部楼层
做個記號   我想找出正確值   MacGyver
发表于 2017-6-21 23:24:51 | 显示全部楼层
回复 1# heavenm

查了半天 果然查不ˇ到這個 -189 的來歷
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-25 07:56 , Processed in 0.075837 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表