Function Reference


_ClipBoard_RegisterFormat

Registers a new clipboard format

#include <Clipboard.au3>
_ClipBoard_RegisterFormat ( $sFormat )

Parameters

$sFormat The name of the new format

Return Value

Success: The registered clipboard format
Failure: 0

Remarks

If a registered format with the specified name already exists, a new format is not registered and the return value identifies the existing format. This enables more than one application to copy and paste data using the same registered clipboard format. Note that the format name comparison is case-insensitive.

Related

_ClipBoard_EnumFormats

See Also

Search RegisterClipboardFormat in MSDN Library.

Example

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

Global $g_idMemo

Example()

Func Example()
        Local $iFormat

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

        ; Register a new clipboard format
        $iFormat = _ClipBoard_RegisterFormat("AutoIt Library Text")
        If $iFormat <> 0 Then

                ; Show new format
                MemoWrite(_ClipBoard_GetFormatName($iFormat))
        Else
                _WinAPI_ShowError("_ClipBoard_RegisterFormat 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