Hi, ich bins (leider) noch mal.
ich versuche gerade mit
[autoit]GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
[/autoit]zu arbeiten.
erreichen möchte ich, dass, sobald eine zeile markiert ist (quasi blau vervorgehoben), der text in spalte 1 kopiert wird, als 2tes soll man in dem listview mit den scollrad "scrollen" können. standardmäßig soll eine zeile markiert sein und beim scrollen dann jeweils die markierung hoch oder runterlaufen.
irgendwie bekomme ich bei den funktionen unten aber nichts zurück ... wer kann mir helfen?
Spoiler anzeigen
#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#Include <GuiListView.au3>
#Include <Date.au3>
#include <MouseSetOnEvent_UDF.au3>
#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]Global $iMemo, $hNext = 0, $hGui, $hListView
;_MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MOUSE_WHELLDOWN_EVENT")
; Create GUI
$hGUI = GUICreate("Clipboard", 400, 176, 0, 0, $WS_POPUPWINDOW, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$ListView = GUICtrlCreateListView("Clipboard|Time", 0, 0, 400, 176, BitOR($LVS_NOCOLUMNHEADER,$LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_HEADERDRAGDROP,$LVS_EX_FULLROWSELECT))
;$ListView2 = GUICtrlCreateListView("Clipboard|Time", 0, 0, 400, 176, BitOR($LVS_NOCOLUMNHEADER,$LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_CHECKBOXES,$LVS_EX_HEADERDRAGDROP,$LVS_EX_FULLROWSELECT))
;GUICtrlSetState($ListView2, $GUI_Hide)
$iMemo = GUICtrlGetHandle($ListView)
;$iMemo2 = GUICtrlGetHandle($ListView2)
_GUICtrlListView_SetColumnWidth($iMemo, 0, 270)
_GUICtrlListView_SetColumnWidth($iMemo, 1, 120)
;_GUICtrlListView_SetColumnWidth($iMemo2, 0, 270)
;_GUICtrlListView_SetColumnWidth($iMemo2, 1, 120)
;WinSetOnTop($hGUI, "", 1)
GUISetState()
; Initialize clipboard viewer
$hNext = _ClipBoard_SetViewer ($hGUI)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN")
GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD")
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Shut down clipboard viewer
_ClipBoard_ChangeChain ($hGUI, $hNext)
Func _MOUSE_WHELLDOWN_EVENT()
$MousePos = MouseGetPos( )
$State = WinGetState($hGUI)
If $State = 15 Or $State = 7 Then
WinSetState($hGUI, "", @SW_HIDE)
ElseIf $State = 23 Then
WinMove($hGUI, "", $MousePos[0], $MousePos[1])
WinSetState($hGUI, "", @SW_SHOW)
WinActivate($hGUI)
Else
WinMove($hGUI, "", $MousePos[0], $MousePos[1])
WinSetState($hGUI, "", @SW_SHOW)
WinActivate($hGUI)
EndIf
EndFunc
; Write message to memo
Func MemoWrite($sMessage = "")
_GUICtrlListView_AddItem($iMemo, $sMessage)
_GUICtrlListView_AddSubItem($iMemo, _GUICtrlListView_GetItemCount($iMemo) - 1, _now(), 1)
;_GUICtrlListView_AddItem($iMemo, $sMessage)
;_GUICtrlListView_AddSubItem($iMemo, _GUICtrlListView_GetItemCount($iMemo) - 1, _now(), 1)
EndFunc ;==>MemoWrite
; Handle $WM_CHANGECBCHAIN messages
Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam)
; Show that message was received
MemoWrite("***** $WM_CHANGECBCHAIN *****")
; If the next window is closing, repair the chain
If $iwParam = $hNext Then
$hNext = $ilParam
; Otherwise pass the message to the next viewer
ElseIf $hNext <> 0 Then
_SendMessage ($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd")
EndIf
EndFunc ;==>WM_CHANGECBCHAIN
; Handle $WM_DRAWCLIPBOARD messages
Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam)
; Display any text on clipboard
MemoWrite(_ClipBoard_GetData ())
; Pass the message to the next viewer
If $hNext <> 0 Then _SendMessage ($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam)
EndFunc ;==>WM_DRAWCLIPBOARD
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView
$hWndListView = $iMemo
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_BEGINSCROLL ; A scrolling operation starts, Minium OS WinXP
Local $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"))
; No return value
Case $LVN_ENDSCROLL ; A scrolling operation ends, Minium OS WinXP
Local $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"))
; No return value
Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
$line = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 1)
MsgBox(0, "", $line)
Return 0 ; allow the list view to perform its normal track select processing.
;Return 1 ; the item will not be selected.
Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$line = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 1)
MsgBox(0, "", $line)
Return 0
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$line = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 1)
MsgBox(0, "", $line)
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