There is an implementation of remote file transfer via dragging virtual files using IStream
/IDataObject
(based on Raymond Chen's blog topic: What a drag: Dragging a virtual file (IStream edition)).
Basically, it works good. But if the application is run under the SYSTEM
account, the IDataObject::GetData()
is called only once - requests a FILEDESCRIPTOR
, but doesn't return with a requests for FILECONTENTS
.
How I use IDataObject
:
if (SUCCEEDED(OleInitialize(NULL))) {
IDataObject* dtob = new MyDataObject(/*some files info here*/);
if (dtob) {
OleSetClipboard(dtob);
dtob->Release();
}
//simulate Ctrl-V
...
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
OleUninitialize();
}