创建一个列表视图(ListView)控件
#Include <GuiListView.au3>
_GUICtrlListView_Create($hWnd, $sHeaderText, $iX, $iY[, $iWidth = 150[, $iHeight = 150[, $iStyle = 0x0000000D[, $iExStyle = 0x00000000[, $fCoInit = False]]]]])
$hWnd | 父窗口或者所有者窗口句柄 |
$sHeaderText | 头部中显示的文本. 使用管道符 "|" 分割. |
$iX | 控件水平坐标 |
$iY | 控件垂直坐标 |
$iWidth | [可选参数] 控件宽度 |
$iHeight | [可选参数] 控件高度 |
$iStyle | [可选参数] 控件样式: $LVS_ALIGNLEFT - 在(小)图标视图中,项目向左对齐 $LVS_ALIGNTOP - 在(小)图标视图中,项目向控件顶部对齐 $LVS_AUTOARRANGE - 在(小)图标视图中,图标自动排序 $LVS_EDITLABELS - 项目文本为可编辑状态 $LVS_ICON - 指定图标视图 $LVS_LIST - 指定列表视图 $LVS_NOCOLUMNHEADER - 在报告视图中不显示列头 $LVS_NOLABELWRAP - 图标视图中项目文本单行显示 $LVS_NOSCROLL - 禁止滚动条 $LVS_NOSORTHEADER - 列头不作为按钮 $LVS_OWNERDATA - 指定虚拟控制(virtual control)* $LVS_OWNERDRAWFIXED - 窗口所有者可以在项目文本中输出项目 $LVS_REPORT - 指定报告视图 $LVS_SHAREIMAGELISTS - 图标列不被删除(注:使用系统图标时有用) $LVS_SHOWSELALWAYS - 总是显示所选项 $LVS_SINGLESEL - 只允许选择一行 $LVS_SMALLICON - 指定小图标视图 $LVS_SORTASCENDING - 项目索引按升序排列 $LVS_SORTDESCENDING - 项目索引按降序排列 |
默认: $LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS 强制 : $WS_CHILD, $WS_VISIBLE |
|
$iExStyle | [可选参数] 扩展控件样式. 可以包含下列值: $LVS_EX_BORDERSELECT - 选中项目时该项目边框颜色改变 $LVS_EX_CHECKBOXES - 使用复选框 $LVS_EX_DOUBLEBUFFER - 屏幕绘制时使用双缓冲,以减少闪烁(xp有效) $LVS_EX_FLATSB - 使用平面格式滚动条 $LVS_EX_FULLROWSELECT - 一项被选中,它的所有子项都高亮显示 $LVS_EX_GRIDLINES - 在项和子项周围显示网格线 $LVS_EX_HEADERDRAGDROP - 拖放单列排序 $LVS_EX_INFOTIP - 显示工具提示之前,发送由$LVN_GETINFOTIP定义的通知消息 $LVS_EX_LABELTIP - 在列表视图中,如果一个部分隐藏的标签缺少工具提示,控件将折叠标签* $LVS_EX_MULTIWORKAREAS - 除非定义了一个或更多的工作区域,否则控件不会自动排列图标* $LVS_EX_ONECLICKACTIVATE - 用户点击项目时,发送$LVN_ITEMACTIVATE消息 $LVS_EX_REGIONAL - 设定控件区域只包含项目图标和文本 $LVS_EX_SIMPLESELECT - 在图标视图,将控件状态图像移动到右上方* $LVS_EX_SUBITEMIMAGES - 允许子项显示图像 $LVS_EX_TRACKSELECT - 允许热轨道(hot-track)选择* $LVS_EX_TWOCLICKACTIVATE - 用户双击项目时发送$LVN_ITEMACTIVATE消息 $LVS_EX_UNDERLINECOLD - 非热点项目被激活时显示文本下划线 $LVS_EX_UNDERLINEHOT - 热点项目被激活时显示文本下划线 |
$fCoInit | [可选参数] Initializes the COM library for use by the calling thread. |
成功: | ListView 控件句柄 |
失败: | 0 |
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
$Debug_LV = False ; 检查传递给 ListView 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作
Global $hListView
_Main()
Func _Main()
Local $GUI, $hImage
$GUI = GUICreate("(UDF Created) ListView Create", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
; 加载图像
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
; 添加列
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)
; 添加项目
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~ Local $tBuffer
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
;~ Case $LVN_BEGINDRAG ; A drag-and-drop operation involving the left mouse button is being initiated
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; 没有返回值
;~ Case $LVN_BEGINLABELEDIT ; Start of label editing for an item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ _DebugPrint("$LVN_BEGINLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ Return False ; Allow the user to edit the label
;~ ;Return True ; Prevent the user from editing the label
;~ Case $LVN_BEGINRDRAG ; A drag-and-drop operation involving the right mouse button is being initiated
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_BEGINRDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; 没有返回值
;~ Case $LVN_BEGINSCROLL ; A scrolling operation starts, Minium OS WinXP
;~ $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
;~ _DebugPrint("$LVN_BEGINSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _
;~ "-->DY:" & @TAB & DllStructGetData($tInfo, "DY"))
;~ ; 没有返回值
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; 没有返回值
;~ Case $LVN_DELETEALLITEMS ; All items in the control are about to be deleted
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_DELETEALLITEMS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ Return True ; To suppress subsequent $LVN_DELETEITEM messages
;~ ;Return False ; To receive subsequent $LVN_DELETEITEM messages
;~ Case $LVN_DELETEITEM ; An item is about to be deleted
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_DELETEITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; 没有返回值
;~ Case $LVN_ENDLABELEDIT ; The end of label editing for an item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_ENDLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ ; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
;~ ; If Text is empty the return value is ignored
;~ Return True
;~ Case $LVN_ENDSCROLL ; A scrolling operation ends, Minium OS WinXP
;~ $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
;~ _DebugPrint("$LVN_ENDSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _
;~ "-->DY:" & @TAB & DllStructGetData($tInfo, "DY"))
;~ ; 没有返回值
;~ Case $LVN_GETDISPINFO ; Provide information needed to display or sort a list-view item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_GETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ ; 没有返回值
;~ Case $LVN_GETINFOTIP ; Sent by a large icon view list-view control that has the $LVS_EX_INFOTIP extended style
;~ $tInfo = DllStructCreate($tagNMLVGETINFOTIP, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_GETINFOTIP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam"))
;~ ; 没有返回值
;~ Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_HOTTRACK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ Return 0 ; allow the list view to perform its normal track select processing.
;~ ;Return 1 ; the item will not be selected.
;~ Case $LVN_INSERTITEM ; A new item was inserted
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_INSERTITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; 没有返回值
;~ Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
;~ $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
;~ _DebugPrint("$LVN_ITEMACTIVATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
;~ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;~ Return 0
;~ Case $LVN_ITEMCHANGED ; An item has changed
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_ITEMCHANGED" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; 没有返回值
;~ Case $LVN_ITEMCHANGING ; An item is changing
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_ITEMCHANGING" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ Return True ; prevent the change
;~ ;Return False ; allow the change
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; 没有返回值
;~ Case $LVN_MARQUEEBEGIN ; A bounding box (marquee) selection has begun
;~ _DebugPrint("$LVN_MARQUEEBEGIN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode)
;~ Return 0 ; accept the message
;~ ;Return 1 ; quit the bounding box selection
;~ Case $LVN_SETDISPINFO ; Update the information it maintains for an item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_SETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ ; 没有返回值
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; 没有返回值
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; 没有返回值
;~ Case $NM_HOVER ; Sent by a list-view control when the mouse hovers over an item
;~ _DebugPrint("$NM_HOVER" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode)
;~ Return 0 ; process the hover normally
;~ ;Return 1 ; prevent the hover from being processed
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; 没有返回值
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; 没有返回值
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; 没有返回值
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; 没有返回值
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint