win32clipboard.SetClipboardText

int = SetClipboardText(text, format )

Convienience function to call SetClipboardData with text.

Parameters

text : str/unicode

The text to place on the clipboard.

format=CF_TEXT : int

The clipboard format to use - must be CF_TEXT or CF_UNICODETEXT

Comments

You may pass a Unicode or string/bytes object to this function, but depending on the value of the 'format' param, it may be converted to the appropriate type for that param.

Many applications will want to call this function twice, with the same string specified but CF_UNICODETEXT specified the second.

Win32 API References

Search for SetClipboardData at msdn, google or google groups.

Return Value

If the function succeeds, the return value is integer handle of the data.
If the function fails, win32api.error is raised with the GetLastError info.