#include <GuiConstantsEx.au3>
#include <GuiEdit.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
Global $iMemo
_Main()
Func _Main()
Local $hGUI, $btn_SetData, $btn_GetData,$str,$str1
; Create GUI
$hGUI = GUICreate("Clipboard", 400, 350)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, BitOR($ES_AUTOVSCROLL, $ES_READONLY))
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 50, 310, 120, 30)
$btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 210, 310, 120, 30)
GUISetState()
; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_SetData
_ClipBoard_SetData ("ClipBoard Library")
Case $btn_GetData
$str=_ClipBoard_GetData ()
If $str<>0 Then
MemoWrite($str)
Else
$str1=ClipGet()
MemoWrite($str1)
EndIf
EndSwitch
WEnd
EndFunc ;==>_Main
; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
|