| 1506 | } |
| 1507 | |
| 1508 | void CLogView::Copy() |
| 1509 | { |
| 1510 | std::ostringstream ss; |
| 1511 | |
| 1512 | if (!m_highlightText.empty()) |
| 1513 | { |
| 1514 | ss << Str(m_highlightText); |
| 1515 | } |
| 1516 | else |
| 1517 | { |
| 1518 | int item = -1; |
| 1519 | while ((item = GetNextItem(item, LVNI_ALL | LVNI_SELECTED)) >= 0) |
| 1520 | ss << GetItemText(item) << "\r\n"; |
| 1521 | } |
| 1522 | const std::string& str = ss.str(); |
| 1523 | |
| 1524 | Win32::HGlobal hdst(GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, str.size() + 1)); |
| 1525 | Win32::GlobalLock<char> lock(hdst); |
| 1526 | std::copy(str.begin(), str.end(), stdext::checked_array_iterator<char*>(lock.Ptr(), str.size())); |
| 1527 | lock.Ptr()[str.size()] = '\0'; |
| 1528 | if (OpenClipboard()) |
| 1529 | { |
| 1530 | EmptyClipboard(); |
| 1531 | SetClipboardData(CF_TEXT, hdst.release()); |
| 1532 | CloseClipboard(); |
| 1533 | } |
| 1534 | } |
| 1535 | |
| 1536 | std::wstring CLogView::GetHighlightText() const |
| 1537 | { |