473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Data Transfers and IAsyncOperation

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(&pDataObj ect) ;
pDataObject->AddRef();
.....
hr = ::DoDragDrop( 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!
Mar 28 '07 #1
2 2677
You may wish to read the following articles:

1) http://msdn2.microsoft.com/en-us/library/aa969396.aspx
2) http://msdn.microsoft.com/msdnmag/issues/1100/wicked/
3) http://www.techvanguards.com/com/con...ithreading.asp

Since you are using a background thread to handle the data transfer, the
interface pointers must be marshaled between the threads.

Using CoMarshalInterThreadInterfaceInStream is one solution to try, if you
use the IStream interface for your data. Another is using the
IGlobalInterfaceTable interface.

See the MSDN documentation for the proper use of these interfaces.

Additionally, you may wish to post your question in the PlatformSDK.Shell
newsgroup as that newsgroup handles questions regarding NSE's and the
various Shell Interfaces.
"JDavide" <JD*****@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
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(&pDataObj ect) ;
pDataObject->AddRef();
....
hr = ::DoDragDrop( 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!

Mar 28 '07 #2
Thank you very much, I'll read the articles. Thanks also for the hint about
the PlatformSDK newsgroup! :)
Mar 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: | last post by:
I am having a major problem with file transfers - they are ending early when the bandwidth tops-out. Smaller files transfer just fine, but large files (12Mb+) can 'abort' the transfer after maybe...
1
by: Nathan Bloom | last post by:
Hi, I have a procedure that transfer data from an Excel spreadsheet to an Access 2000 table. There is a start date and an end date in the range specified. One of the date fields transfers...
1
by: Sean McKaharay | last post by:
Hey All, I am trying to write an app that will transfer data from one SQL Server to another. Here is my situation: I have 2 computers neither one is connected. I have the same database on both...
3
by: Shmulik | last post by:
I have an application written in C# that creates a queue of items to process, connects via a TCP connection to a server on a Unix box, and then passes data files to the Unix box for processing...
1
by: BStrick | last post by:
I would like to know what may be the "Best" way to approach with problem. I have an application that I created to transfers data dynamically from an unknown source (ie maybe Excel, Access, XML,...
9
by: David Harris | last post by:
Ok, so I'm semi-new to .NET, having done everything manually with SQL code back in VB6. So before I program this up completely manually again, I thought I'd ask for better ways to think through...
7
by: Scott Gifford | last post by:
As a possible solution to a problem I'm trying to solve with an iterator (see an earlier post by me with subject "Iterator implementation questions: copy constructor and postfix increment"), I'm...
4
by: rakesh.usenet | last post by:
For a particular application of mine - I need a simulation of byte array output stream. * write data onto a stream * getback the contiguous content as an array later for network transport. ...
4
by: rsmolik | last post by:
Hi, I have a list box that allows you to select multiple values and then transfers the selected values to a table. I have almost cracked this but I am having a small problem; My code is as...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.