-TRM-,
Код:
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
Global $hListView
GUICreate("WM_NOTIFY Demo", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetColumnWidth($hListView, 0, 90)
_GUICtrlListView_AddColumn($hListView, "Items", 100)
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iCode, $tNMHDR, $hWndListView
$hWndListView = $hListView
If Not IsHWnd($hListView) Then
$hWndListView = GUICtrlGetHandle($hListView)
EndIf
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_ITEMCHANGING; An item is changing
;Return True; prevent the change
;Return False; allow the change
Return 1
Case $LVN_BEGINDRAG, $LVN_BEGINRDRAG ;A drag-and-drop operation involving the left/right mouse button is being initiated
Return 1
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc