本文整理汇总了C++中CClipboard::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CClipboard::Open方法的具体用法?C++ CClipboard::Open怎么用?C++ CClipboard::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClipboard
的用法示例。
在下文中一共展示了CClipboard::Open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClipboardSetText
bool ClipboardSetText(HWND owner, const UString &s)
{
CClipboard clipboard;
if (!clipboard.Open(owner))
return false;
#ifdef _WIN32
if (!::EmptyClipboard())
return false;
bool res;
res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Length() + 1) * sizeof(wchar_t));
#ifndef _UNICODE
AString a;
a = UnicodeStringToMultiByte(s, CP_ACP);
res |= ClipboardSetData(CF_TEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
a = UnicodeStringToMultiByte(s, CP_OEMCP);
res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
#endif
return res;
#else
wxTheClipboard->Clear();
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxString ws(s);
wxTheClipboard->SetData( new wxTextDataObject(ws) );
return true;
#endif
}
示例2: ClipboardSetText
bool ClipboardSetText(HWND owner, const UString &s)
{
CClipboard clipboard;
if (!clipboard.Open(owner))
return false;
if (!::EmptyClipboard())
return false;
bool res;
res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Length() + 1) * sizeof(wchar_t));
#ifndef _UNICODE
AString a;
a = UnicodeStringToMultiByte(s, CP_ACP);
res |= ClipboardSetData(CF_TEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
a = UnicodeStringToMultiByte(s, CP_OEMCP);
res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Length() + 1) * sizeof(char));
#endif
return res;
}