#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>
;~ Opt('MustDeclareVars', 1)
Global $iMemo, $hNext = 0
Local $hGUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
$hNext = _ClipBoard_SetViewer($hGUI)
GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN")
GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD")
MemoWrite("GUI handle ....: " & $hGUI)
MemoWrite("Viewer handle .: " & _ClipBoard_GetViewer())
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_ClipBoard_ChangeChain($hGUI, $hNext)
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam)
MemoWrite("***** $WM_CHANGECBCHAIN *****")
If $iwParam = $hNext Then
$hNext = $ilParam
ElseIf $hNext <> 0 Then
_SendMessage($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd")
EndIf
EndFunc ;==>WM_CHANGECBCHAIN
Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam)
MemoWrite(_ClipBoard_GetData())
If $hNext <> 0 Then _SendMessage($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam)
EndFunc ;==>WM_DRAWCLIPBOARD
|