Function Reference


_ClipBoard_Empty

Empties the clipboard and frees handles to data in the clipboard

#include <Clipboard.au3>
_ClipBoard_Empty ( )

Return Value

Success: True
Failure: False

Remarks

Before calling this function, you must open the clipboard by using the _ClipBoard_Open() function.
If you specified a NULL window handle when opening the clipboard, this function succeeds but sets the clipboard owner to NULL.
Note that this causes _ClipBoard_SetData() to fail.

Related

_ClipBoard_GetOwner, _ClipBoard_Open, _ClipBoard_SetData, _ClipBoard_SetDataEx

See Also

Search EmptyClipboard in MSDN Library.

Example

#include <Clipboard.au3>
#include <GUIConstantsEx.au3>
#include <WinAPIError.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

Example()

Func Example()
        Local $hGUI

        ; Create GUI
        $hGUI = GUICreate("Clipboard", 600, 400)
        $g_idMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
        GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
        GUISetState(@SW_SHOW)

        ; Open the clipboard
        If _ClipBoard_Open($hGUI) Then
                ShowData($hGUI)

                ; Empty the clipboard
                If Not _ClipBoard_Empty() Then _WinAPI_ShowError("_ClipBoard_Empty failed")

                ; Close the clipboard
                _ClipBoard_Close()
        Else
                _WinAPI_ShowError("_ClipBoard_Open failed")
        EndIf

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

; Show clipboard statistics
Func ShowData($hGUI)
        MemoWrite("GUI handle ............: " & $hGUI)
        MemoWrite("Clipboard owner .......: " & _ClipBoard_GetOwner())
        MemoWrite("Clipboard open window .: " & _ClipBoard_GetOpenWindow())
        MemoWrite("Clipboard sequence ....: " & _ClipBoard_GetSequenceNumber())
        MemoWrite()
EndFunc   ;==>ShowData

; Write message to memo
Func MemoWrite($sMessage = "")
        GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite