Reputation: 827
I am trying to implement Drag And Drop Functionality from Web Pages to C++ Applications.
I am setting text on drag to dataTransfer object and now trying to access it on DropTarget from IDataObject. To Get Data from IDataObject, we need to specify FORMATETC, which I guess I am facing problem with.
Here is the code: On HTML Side I have below javascript executed on Drag.
function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);
}
On C++ side: I have DropTarget, implementing IDropTarget and inside ::Drop method i receive IDataObject.
To get data from this, I am using below code:
FORMATETC fre;
fre.cfFormat = CF_TEXT;
fre.dwAspect = DVASPECT_CONTENT;
fre.ptd = nullptr;
fre.tymed = TYMED_HGLOBAL;
fre.lindex = -1;
STGMEDIUM stg;
stg.hGlobal = nullptr;
stg.pUnkForRelease = nullptr;
bool result = false;
if (NOERROR == pDataObj->GetData(&fre, &stg))
{
result = true;
}
But I am not able to retrieve data here. Can someone please help me out here?
Thanks, Kailas
Upvotes: 1
Views: 131