| 50 | } |
| 51 | |
| 52 | void WindowsClipboard::SetFiles(const Array<String>& files) |
| 53 | { |
| 54 | int32 size = sizeof(DROPFILES); |
| 55 | for (int32 i = 0; i < files.Count(); i++) |
| 56 | { |
| 57 | size += (files[i].Length() + 1) * sizeof(Char); |
| 58 | } |
| 59 | size += 2 * sizeof(Char); |
| 60 | |
| 61 | HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, size); |
| 62 | DROPFILES* data = (DROPFILES*)GlobalLock(hMem); |
| 63 | ZeroMemory(data, size); |
| 64 | data->pFiles = sizeof(DROPFILES); |
| 65 | data->fWide = TRUE; |
| 66 | LPWSTR ptr = (LPWSTR)(data + 1); |
| 67 | for (int32 i = 0; i < files.Count(); i++) |
| 68 | { |
| 69 | Platform::MemoryCopy(ptr, files[i].Get(), (files[i].Length() + 1) * sizeof(Char)); |
| 70 | ptr += files[i].Length() + 1; |
| 71 | } |
| 72 | *ptr++ = 0; |
| 73 | *ptr = 0; |
| 74 | GlobalUnlock(hMem); |
| 75 | |
| 76 | OpenClipboard(nullptr); |
| 77 | EmptyClipboard(); |
| 78 | SetClipboardData(CF_HDROP, hMem); |
| 79 | CloseClipboard(); |
| 80 | } |
| 81 | |
| 82 | String WindowsClipboard::GetText() |
| 83 | { |