# Function Reference

# _WinAPI_AddClipboardFormatListener

Places the given window in the system-maintained clipboard format listener list

#include <WinAPISys.au3>
_WinAPI_AddClipboardFormatListener ( $hWnd )

## Parameters

$hWnd | Handle to the window to be placed.

## Return Value

Success: | True.
Failure: | False, call _WinAPI_GetLastError() to get extended error information.

## Remarks

This function requires Windows Vista or later.

## See Also

Search AddClipboardFormatListener in MSDN Library.

## Example

    #include <Clipboard.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <MsgBoxConstants.au3>
    #include <SendMessage.au3>
    #include <WinAPISys.au3>
    #include <WindowsNotifsConstants.au3>
    #include <WindowsStylesConstants.au3>

    If Number(_WinAPI_GetVersion()) < 6.0 Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later.')
        Exit
    EndIf

    Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 400, 10, 10, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $WS_EX_TOPMOST)
    Global $g_idEdit = GUICtrlCreateEdit('', 0, 0, 400, 400, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY))
    GUIRegisterMsg($WM_CLIPBOARDUPDATE, 'WM_CLIPBOARDUPDATE')
    GUISetState(@SW_SHOW)

    _WinAPI_AddClipboardFormatListener($hForm)
    _SendMessage($hForm, $WM_CLIPBOARDUPDATE)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    Func WM_CLIPBOARDUPDATE($hWnd, $iMsg, $wParam, $lParam)
        #forceref $hWnd, $iMsg, $wParam, $lParam

        _ClipBoard_Open(0)
        GUICtrlSetData($g_idEdit, _ClipBoard_GetData($CF_TEXT))
        _ClipBoard_Close()
        Return 0
    EndFunc   ;==>WM_CLIPBOARDUPDATE