Hallo,
ich arbeite gerade an einem ClipBoard-Viewer ...
mit Text kommt der schon supi klar ... was ist aber mit Dateien?
Ich habe ein ListView, in dem alle Sachen, die im Clipboard waren, abgespeichert werden. mit einem Klick auf die entsprechende Zeile kann man dann wieder alten Text in die Zwischenablage holen (wird aber nicht neu im Listview angezeigt).
bei Dateien sollte da jetzt Dateiname (und evtl. der Pfad) angegeben sein ... bei einem klick, wenn möglich, die datei wieder in der zwischenablage sein, falls das nicht geht, zumindest der pfad.
kann mir wer helfen?
aktuell sieht das script so aus (ein-/ ausblenden des Listviews mit Maus3)
Spoiler anzeigen
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\_Icons\shell32.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;vertikale Scrollleiste
#include <Clipboard.au3>
#include <Date.au3>
#include <GuiListView.au3>
#include "O:\AutoIT\Includes\MouseSetOnEvent_UDF.au3"
#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StructureConstants.au3>
#include <WindowsConstants.au3>
;#include <Events.au3>
Global $iMemo, $hNext = 0, $hGui, $hListView, $hWndFrom, $iCode, $tInfo
_MouseSetOnEvent($MOUSE_WHELLDOWN_EVENT, "_MOUSE_WHELLDOWN_EVENT")
; Create GUI
$hGUI = GUICreate("Clipboard", 415, 176, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$ListView = GUICtrlCreateListView("Clipboard|Time", 0, 0, 415, 176, BitOR($LVS_NOCOLUMNHEADER,$LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_HEADERDRAGDROP,$LVS_EX_FULLROWSELECT))
$iMemo = GUICtrlGetHandle($ListView)
_GUICtrlListView_SetColumnWidth($iMemo, 0, 270)
_GUICtrlListView_SetColumnWidth($iMemo, 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 = "")
If $sMessage <> "" And WinGetHandle("") <> $hGui Then
_GUICtrlListView_InsertItem($iMemo, $sMessage, 0)
;_GUICtrlListView_AddItem($iMemo, $sMessage)
_GUICtrlListView_AddSubItem($iMemo, 0, _now(), 1)
EndIf
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)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~ Local $tBuffer
$hWndListView = $iMemo
If Not IsHWnd($iMemo) 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
$tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
; No return value
Case $LVN_ENDSCROLL ; A scrolling operation ends, Minium OS WinXP
$tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
; No return value
Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
;MsgBox(0, "", $iCode & @CRLF & $gText)
Return 0 ; allow the list view to perform its normal track select processing.
;Return 1 ; the item will not be selected.
; No return value
Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
ClipPut($gText)
;MsgBox(0, "", $iCode & @CRLF & $gText)
Return 0
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
ClipPut($gText)
;MsgBox(0, "", $iCode & @CRLF & $gText)
; No return value
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)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
;MsgBox(0, "", $iCode & @CRLF & $gText)
; No return value
Case $NM_HOVER ; Sent by a list-view control when the mouse hovers over an item
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
;MsgBox(0, "", $iCode & @CRLF & $gText)
Return 0 ; process the hover normally
;Return 1 ; prevent the hover from being processed
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
ClipPut($gText)
;MsgBox(0, "", $iCode & @CRLF & $gText)
;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)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
;MsgBox(0, "", $iCode & @CRLF & $gText)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
$gText = _GUICtrlListView_GetItemText($hWndFrom, DllStructGetData($tInfo, "Index"), 0)
ClipPut($gText)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY