#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$Form1= GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF) ; will change background color
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$listview = GUICtrlCreateListView ("col1 |col2|col3 ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_DROPACCEPTED) ; to allow drag and dropping
GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events")
GUICtrlSetData($item2,"ITEM1")
GUICtrlSetData($item3,"||COL33")
GUICtrlDelete($item1)
GUISetState(@SW_SHOW)
Do
$msg = GUIGetMsg ()
Select
Case $msg = $button
MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
Case $msg = $listview
MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
Local $tagNMHDR, $event, $hwndFrom, $code
$tagNMHDR = DllStructCreate("int;int;int", $lParam)
If @error Then Return
$event = DllStructGetData($tagNMHDR, 3)
If $wParam = $ListView And $event = $NM_DBLCLK Then
xiugai()
EndIf
$tagNMHDR = 0
$event = 0
$lParam = 0
EndFunc
Func xiugai()
GUISetState (@SW_DISABLE, $Form1)
Global $Form2 = GUICreate("Form2", 185, 233, 435, 199)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close")
Global $Input4 = GUICtrlCreateInput("", 32, 24, 121, 21)
Global $Input5 = GUICtrlCreateInput("", 32, 56, 121, 21)
Global $Input6 = GUICtrlCreateInput("", 32, 88, 121, 21)
Global $Input7 = GUICtrlCreateInput("", 32, 120, 121, 21)
Global $Input8 = GUICtrlCreateInput("", 32, 152, 121, 21)
Global $Button2 = GUICtrlCreateButton("修改", 56, 192, 75, 25)
GUISetState(@SW_SHOW)
EndFunc
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Func Form2Close()
GUISetState(@SW_HIDE)
GUISetState (@SW_ENABLE, $Form1)
GUISwitch($Form1)
EndFunc ;==>Form2Close