# Function Reference

# _ClipBoard_Open

Opens the clipboard and prevents other applications from modifying the clipboard

#include <Clipboard.au3>
_ClipBoard_Open ( $hOwner )

## Parameters

$hOwner | Handle to the window to be associated with the open clipboard. If this parameter is 0, the open clipboard is associated with the current task.

## Return Value

Success: | True
Failure: | False

## Remarks

This function fails if another window has the clipboard open. Call the _ClipBoard_Close() function after every successful call to this function.
The window identified by the $hOwner parameter does not become the clipboard owner unless the _ClipBoard_Empty() function is called. If you call _ClipBoard_Open() with hwnd set to 0, _ClipBoard_Empty() sets the clipboard owner to 0 which causes _ClipBoard_SetData() to fail.

## Related

_ClipBoard_Close, _ClipBoard_Empty, _ClipBoard_EnumFormats, _ClipBoard_GetOpenWindow, _ClipBoard_SetDataEx

## See Also

Search OpenClipboard in MSDN Library.

## Example

    #include "Extras\HelpFileInternals.au3"

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

    Example()

    Func Example()
        Local $hGUI

        ; Create GUI
        $hGUI = GUICreate("Clipboard", 600, 400)
        _MemoCreate(2, 2, 596, 396, $WS_VSCROLL)
        GUISetState(@SW_SHOW)

        ; Open the clipboard
        If _ClipBoard_Open($hGUI) Then

            ShowData($hGUI)

            ; 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