G
Guest
Hello again!
I'm trying to implement asynchronous DnD (and Copy/Paste) in a custom NSE:
despite the lack of documentation, I found that i need my DataObject
implement the optional interface IAsyncOperation. I want to always use
asynchronous operations, so I added the following lines to my DataObject
class (I use ATL):
class ATL_NO_VTABLE PPDataObject :
public CComObjectRootEx<CComSingleThreadModel>, public IDataObject, public
IAsyncOperation{
.....
BEGIN_COM_MAP(PPDataObject)
COM_INTERFACE_ENTRY(IDataObject)
COM_INTERFACE_ENTRY(IAsyncOperation)
END_COM_MAP()
....
STDMETHOD(EndOperation)(HRESULT hResult, IBindCtx* pbcReserved, DWORD
dwEffects){
return S_OK;
}
STDMETHOD(GetAsyncMode)(BOOL* pfIsOpAsync){
return VARIANT_TRUE;
}
STDMETHOD(InOperation)(BOOL *pfInAsyncOp){
*pfInAsyncOp=TRUE;
return S_OK;
}
STDMETHOD(SetAsyncMode)(BOOL fDoOpAsync){
return S_OK;
}
STDMETHOD(StartOperation)(IBindCtx *pbcReserved){
return S_OK;
}
....
}
and I call the DataObject as:
CComObject<PPDataObject>* pDataObject;
//CComObject<>* pAsyncOp;
hr= CComObject<PPDataObject>::CreateInstance(&pDataObject) ;
pDataObject->AddRef();
.....
hr = :oDragDrop( pDataObject, pDropSource, DROPEFFECT_MOVE, &dwEffect);
pDropSource->Release();
....
The result is that the operation doesn't occur asynchronously (for big files
doesn't occur at all). I read some opinions which stated that implementing
IAsyncOperation doesn't make Explorer use asynchronous transfers, rather
allows it to... But Explorer always uses asynchronous transfers on my
machine, so I can't understand why I can't force it to even in my NSE!
I need to transer big files, passing first through the network, so a lot of
time can be involved in the process and a synchronous scenario doesn't apply:
Please, can anyone tell me what I'm doing wrong? Wrong interface, wrong
implementation, wrong calls, wrong strategy... ???
Thanks in advance for your help!
I'm trying to implement asynchronous DnD (and Copy/Paste) in a custom NSE:
despite the lack of documentation, I found that i need my DataObject
implement the optional interface IAsyncOperation. I want to always use
asynchronous operations, so I added the following lines to my DataObject
class (I use ATL):
class ATL_NO_VTABLE PPDataObject :
public CComObjectRootEx<CComSingleThreadModel>, public IDataObject, public
IAsyncOperation{
.....
BEGIN_COM_MAP(PPDataObject)
COM_INTERFACE_ENTRY(IDataObject)
COM_INTERFACE_ENTRY(IAsyncOperation)
END_COM_MAP()
....
STDMETHOD(EndOperation)(HRESULT hResult, IBindCtx* pbcReserved, DWORD
dwEffects){
return S_OK;
}
STDMETHOD(GetAsyncMode)(BOOL* pfIsOpAsync){
return VARIANT_TRUE;
}
STDMETHOD(InOperation)(BOOL *pfInAsyncOp){
*pfInAsyncOp=TRUE;
return S_OK;
}
STDMETHOD(SetAsyncMode)(BOOL fDoOpAsync){
return S_OK;
}
STDMETHOD(StartOperation)(IBindCtx *pbcReserved){
return S_OK;
}
....
}
and I call the DataObject as:
CComObject<PPDataObject>* pDataObject;
//CComObject<>* pAsyncOp;
hr= CComObject<PPDataObject>::CreateInstance(&pDataObject) ;
pDataObject->AddRef();
.....
hr = :oDragDrop( pDataObject, pDropSource, DROPEFFECT_MOVE, &dwEffect);
pDropSource->Release();
....
The result is that the operation doesn't occur asynchronously (for big files
doesn't occur at all). I read some opinions which stated that implementing
IAsyncOperation doesn't make Explorer use asynchronous transfers, rather
allows it to... But Explorer always uses asynchronous transfers on my
machine, so I can't understand why I can't force it to even in my NSE!
I need to transer big files, passing first through the network, so a lot of
time can be involved in the process and a synchronous scenario doesn't apply:
Please, can anyone tell me what I'm doing wrong? Wrong interface, wrong
implementation, wrong calls, wrong strategy... ???
Thanks in advance for your help!