MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SetFiles

Method SetFiles

Source/Engine/Platform/Windows/WindowsClipboard.cpp:52–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void 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
82String WindowsClipboard::GetText()
83{

Callers

nothing calls this directly

Calls 3

CountMethod · 0.45
LengthMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected