RegisterClipboardFormatA function (winuser.h)

Registers a new clipboard format. This format can then be used as a valid clipboard format.

Syntax

UINT RegisterClipboardFormatA(
  [in] LPCSTR lpszFormat
);

Parameters

[in] lpszFormat

Type: LPCTSTR

The name of the new format.

Return value

Type: UINT

If the function succeeds, the return value identifies the registered clipboard format.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

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.

Registered clipboard formats are identified by values in the range 0xC000 through 0xFFFF.

When registered clipboard formats are placed on or retrieved from the clipboard, they must be in the form of an HGLOBAL value.

Examples

For an example, see Registering a Clipboard Format.

Note

The winuser.h header defines RegisterClipboardFormat as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-misc-l1-2-0 (introduced in Windows 8.1)

See also

Clipboard

Conceptual

CountClipboardFormats

EnumClipboardFormats

GetClipboardFormatName

Reference