uLib  User mode C/C++ extended API library for Win32 programmers.

Module Description

Supplementary clipboard APIs

Macros

#define PutClipboardString   PutClipboardStringA
 

Typedefs

typedef bool(__stdcall * PFClipFmtAction) (UINT FmtTag, PVOID UserData)
 

Functions

bool OpenEmptyClipboard (HWND hWnd)
 
UINT EnumerateClipFormats (HWND hCBOwner, PFClipFmtAction Action, PVOID UserData)
 
bool PutClipHandle (HWND clipboardOwner, HANDLE hClip, UINT clipFmt)
 
HANDLE GetClipHandle (UINT clipFmt)
 
bool PutClipboardStringA (HWND clipboardOwner, ACSTR Text)
 
bool PutClipboardStringW (HWND clipboardOwner, WCSTR Text)
 
CSTR DupClipboardString ()
 
PVOID DupClipboardData (UINT clipFmt, PUINT pSize OPTOUT)
 

Macro Definition Documentation

◆ PutClipboardString

#define PutClipboardString   PutClipboardStringA

Definition at line 1008 of file UtilFunc.h.

Typedef Documentation

◆ PFClipFmtAction

typedef bool(__stdcall * PFClipFmtAction) (UINT FmtTag, PVOID UserData)

PFClipFmtAction is the callback for EnumerateClipFormats().

The callback is invoked with the clipboard open for reading.
Return true to continue the enumeration.

Definition at line 976 of file UtilFunc.h.

Function Documentation

◆ OpenEmptyClipboard()

bool OpenEmptyClipboard ( HWND  hWnd)

OpenEmptyClipboard opens and clears the clipboard for writing.
Note: If hWnd is NULL, EmptyClipboard() sets the clipboard owner to NULL,
which causes any subsequent SetClipboardData() to fail.

Definition at line 48 of file UserUtil.cpp.

◆ EnumerateClipFormats()

UINT EnumerateClipFormats ( HWND  hCBOwner,
PFClipFmtAction  Action,
PVOID  UserData 
)

EnumerateClipFormats is much less cumbersome than EnumClipboardFormats().
It returns the count of formats actually sent to the callback.

Definition at line 55 of file UserUtil.cpp.

◆ PutClipHandle()

bool PutClipHandle ( HWND  clipboardOwner,
HANDLE  hClip,
UINT  clipFmt 
)

PutClipHandle puts a handle (i.e it's data) on the clipboard.
After a successful call, the clipboard gains ownership of hClip.
Note: If clipboardOwner is NULL, PutClipHandle will fail.
See also OpenEmptyClipboard().

Definition at line 73 of file UserUtil.cpp.

◆ GetClipHandle()

HANDLE GetClipHandle ( UINT  clipFmt)

GetClipHandle gets a data handle from the clipboard.
Note: The system clipboard still owns the handle!

[MSDN]\n GetClipboardData() notes that CloseClipboard() invalidates the handle.\n
However, though the clipboard is closed on return from GetClipHandle(), empirical
tests show that the handle remain valid until the clipboard is (re)used by someone.

Definition at line 85 of file UserUtil.cpp.

◆ PutClipboardStringA()

bool PutClipboardStringA ( HWND  clipboardOwner,
ACSTR  Text 
)

PutClipboardString copies a string to the clipboard.
Note: For multi-line text, CRLF line endings are mandated by the clipboard
(due to it's auto-conversion to synthesized text formats).
See also PutClipHandle().

Definition at line 111 of file UserUtil.cpp.

◆ PutClipboardStringW()

bool PutClipboardStringW ( HWND  clipboardOwner,
WCSTR  Text 
)

See PutClipboardStringA().

Definition at line 117 of file UserUtil.cpp.

◆ DupClipboardString()

CSTR DupClipboardString ( )

DupClipboardString duplicates a string from the clipboard.
Free the string with GlobalFree() when done.

Definition at line 123 of file UserUtil.cpp.

◆ DupClipboardData()

PVOID DupClipboardData ( UINT  clipFmt,
PUINT pSize  OPTOUT 
)

DupClipboardData duplicates a specific data format from the clipboard.
Free the data with GlobalFree() when done.
Note: The size returned to pSize might be larger than the actual clip size, due to GlobalAlloc implementation details.

Definition at line 139 of file UserUtil.cpp.