FILEGROUPDESCRIPTOR array size?

Hey,

I kinda have to use the windows FILEGROUPDESCRIPTOR which structure looks like this

1
2
3
4
typedef struct _FILEGROUPDESCRIPTOR {
  UINT           cItems;
  FILEDESCRIPTOR fgd[1];
} FILEGROUPDESCRIPTOR, *LPFILEGROUPDESCRIPTOR;


https://msdn.microsoft.com/en-us/library/windows/desktop/bb773290(v=vs.85).aspx

with a fixed array size of 1, which would mean there is a group of 1 file.
is there any way to increase the size of this array, so that windows still is able to read it (e.g from the clipboard with the crtl+v paste functionality)

When I use the drag & drop windows provides already an array whis size depends on the selected files, so it should be possible somehow.


Last edited on
ok nvm i were confused by the [1] instead of a ptr

auto numBytesRequried = sizeof(FILEGROUPDESCRIPTOR) + sizeof(FILEDESCRIPTOR) * (3 - 1);
auto hGlobal = ::GlobalAlloc(GMEM_DDESHARE, numBytesRequried);
auto ptrLock = ::GlobalLock(hGlobal);
auto ptrFilegroup = (FILEGROUPDESCRIPTOR*)ptrLock;


does the job
auto numBytesRequried = sizeof(FILEGROUPDESCRIPTOR) + sizeof(FILEDESCRIPTOR) * (3 - 1); //why don't you use * 2 instead?
this was just a quick test, 3 will be replaced for the number of files used for the filedescriptor
Topic archived. No new replies allowed.