函数参考


_GUICtrlListView_Destroy

删除 ListView 控件

#Include <GuiListView.au3>
_GUICtrlListView_Destroy(ByRef $hWnd)

参数

$hWnd 控件句柄

返回值

成功: 返回 True, 句柄设置为 0
失败: 返回 False

注意/说明

 仅限于用 _GUICtrlListView_Create 函数创建的控件

相关

_GUICtrlListView_Create

示例/演示


#include <GUIConstantsEx.au3>
#include <GuiListView.au3>

$Debug_LV = False ; 检查传递给 ListView 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作

_Main()

Func _Main()

    Local $GUI, $HandleBefore, $hListView

    $GUI = GUICreate("(UDF Created) ListView Destroy", 400, 300)

    $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
    $HandleBefore = $hListView
    GUISetState()

    ; 添加列
    _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")
    _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")
    _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($hListView, "Row 3: Col 1")

    MsgBox(4160, "信息", "Destroying the Control for Handle: " & $hListView)
    MsgBox(4160, "信息", "Control Destroyed: " & _GUICtrlListView_Destroy($hListView) & @LF & _
            "Handel Before Destroy: " & $HandleBefore & @LF & _
            "Handle After Destroy: " & $hListView)

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main