MCPcopy Create free account
hub / github.com/WinMerge/winmerge / GetDroppedFiles

Function GetDroppedFiles

Src/DropHandler.cpp:42–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 //
41
42 std::vector<String> GetDroppedFiles(HDROP dropInfo)
43 {
44 std::vector<String> files;
45 // Get the number of pathnames that have been dropped
46 UINT wNumFilesDropped = DragQueryFile(dropInfo, 0xFFFFFFFF, nullptr, 0);
47
48 // get all file names. but we'll only need the first one.
49 files.reserve(wNumFilesDropped);
50 for (UINT x = 0; x < wNumFilesDropped; x++)
51 {
52 // Get the number of bytes required by the file's full pathname
53 UINT wPathnameSize = DragQueryFile(dropInfo, x, nullptr, 0);
54
55 // Allocate memory to contain full pathname & zero byte
56 wPathnameSize += 1;
57 auto npszFile = std::make_unique<tchar_t[]>(wPathnameSize);
58
59 // Copy the pathname into the buffer
60 DragQueryFile(dropInfo, x, npszFile.get(), wPathnameSize);
61
62 files.push_back(npszFile.get());
63 }
64 return files;
65 }
66
67 std::vector<String> FilterFiles(const std::vector<String>& files_src)
68 {

Callers 1

Calls 2

reserveMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected