diff options
Diffstat (limited to 'CPP/Windows/Clipboard.cpp')
-rwxr-xr-x | CPP/Windows/Clipboard.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/CPP/Windows/Clipboard.cpp b/CPP/Windows/Clipboard.cpp index cc27d3da..1e66522f 100755 --- a/CPP/Windows/Clipboard.cpp +++ b/CPP/Windows/Clipboard.cpp @@ -13,9 +13,9 @@ namespace NWindows { bool CClipboard::Open(HWND wndNewOwner) -{ - m_Open = BOOLToBool(::OpenClipboard(wndNewOwner)); - return m_Open; +{ + m_Open = BOOLToBool(::OpenClipboard(wndNewOwner)); + return m_Open; } CClipboard::~CClipboard() @@ -23,11 +23,11 @@ CClipboard::~CClipboard() Close(); } -bool CClipboard::Close() +bool CClipboard::Close() { if (!m_Open) return true; - m_Open = !BOOLToBool(CloseClipboard()); + m_Open = !BOOLToBool(CloseClipboard()); return !m_Open; } @@ -40,24 +40,24 @@ bool ClipboardIsFormatAvailableHDROP() bool ClipboardGetTextString(AString &s) { s.Empty(); - if (!IsClipboardFormatAvailable(CF_TEXT)) - return false; + if (!IsClipboardFormatAvailable(CF_TEXT)) + return false; CClipboard clipboard; - if (!clipboard.Open(NULL)) - return false; + if (!clipboard.Open(NULL)) + return false; HGLOBAL h = ::GetClipboardData(CF_TEXT); - if (h != NULL) - { - NMemory::CGlobalLock globalLock(h); - const char *p = (const char *)globalLock.GetPointer(); + if (h != NULL) + { + NMemory::CGlobalLock globalLock(h); + const char *p = (const char *)globalLock.GetPointer(); if (p != NULL) { s = p; return true; } - } + } return false; } */ @@ -66,18 +66,18 @@ bool ClipboardGetTextString(AString &s) bool ClipboardGetFileNames(UStringVector &names) { names.Clear(); - if (!IsClipboardFormatAvailable(CF_HDROP)) - return false; + if (!IsClipboardFormatAvailable(CF_HDROP)) + return false; CClipboard clipboard; - if (!clipboard.Open(NULL)) - return false; + if (!clipboard.Open(NULL)) + return false; HGLOBAL h = ::GetClipboardData(CF_HDROP); - if (h != NULL) - { - NMemory::CGlobalLock globalLock(h); - void *p = (void *)globalLock.GetPointer(); + if (h != NULL) + { + NMemory::CGlobalLock globalLock(h); + void *p = (void *)globalLock.GetPointer(); if (p != NULL) { NShell::CDrop drop(false); @@ -85,7 +85,7 @@ bool ClipboardGetFileNames(UStringVector &names) drop.QueryFileNames(names); return true; } - } + } return false; } */ @@ -94,7 +94,7 @@ static bool ClipboardSetData(UINT uFormat, const void *data, size_t size) { NMemory::CGlobal global; if (!global.Alloc(GMEM_DDESHARE | GMEM_MOVEABLE, size)) - return false; + return false; { NMemory::CGlobalLock globalLock(global); LPVOID p = globalLock.GetPointer(); @@ -111,10 +111,10 @@ static bool ClipboardSetData(UINT uFormat, const void *data, size_t size) bool ClipboardSetText(HWND owner, const UString &s) { CClipboard clipboard; - if (!clipboard.Open(owner)) - return false; + if (!clipboard.Open(owner)) + return false; if (!::EmptyClipboard()) - return false; + return false; bool res; res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Length() + 1) * sizeof(wchar_t)); @@ -126,6 +126,6 @@ bool ClipboardSetText(HWND owner, const UString &s) res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Length() + 1) * sizeof(char)); #endif return res; -} +} } |