Function Reference


_ClipBoard_EnumFormats

Enumerates the data formats currently available on the clipboard

#include <Clipboard.au3>
_ClipBoard_EnumFormats ( $iFormat )

Parameters

$iFormat Specifies a clipboard format that is known to be available. To start an enumeration of formats, set $iFormat to zero.
When $iFormat is zero, the function retrieves the first available clipboard format.
For subsequent calls during an enumeration, set $iFormat to the result of the previous call.

Return Value

Success: The clipboard format that follows the specified format
Failure: 0

Remarks

You must open the clipboard before enumerating its formats

Related

_ClipBoard_CountFormats, _ClipBoard_GetPriorityFormat, _ClipBoard_Open, _ClipBoard_RegisterFormat

See Also

Search EnumClipboardFormats in MSDN Library.

Example

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

Global $g_idMemo

Example()

Func Example()
    Local $hGUI, $iFormat, $iCount

    ; 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

        ; Show clipboard formats available
        MemoWrite("Clipboard formats ..: " & _ClipBoard_CountFormats())

        ; Enumerate clipboard formats
        Do
            $iFormat = _ClipBoard_EnumFormats($iFormat)
            If $iFormat <> 0 Then
                $iCount += 1
                MemoWrite("Clipboard format " & $iCount & " .: " & _ClipBoard_FormatStr($iFormat))
            EndIf
        Until $iFormat = 0

        ; 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

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