473,698 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 CComObjectRootE x<CComSingleThr eadModel>, public IDataObject, public
IAsyncOperation {
.....
BEGIN_COM_MAP(P PDataObject)
COM_INTERFACE_E NTRY(IDataObjec t)
COM_INTERFACE_E NTRY(IAsyncOper ation)
END_COM_MAP()
....

STDMETHOD(EndOp eration)(HRESUL T hResult, IBindCtx* pbcReserved, DWORD
dwEffects){
return S_OK;
}
STDMETHOD(GetAs yncMode)(BOOL* pfIsOpAsync){
return VARIANT_TRUE;
}
STDMETHOD(InOpe ration)(BOOL *pfInAsyncOp){
*pfInAsyncOp=TR UE;
return S_OK;
}
STDMETHOD(SetAs yncMode)(BOOL fDoOpAsync){
return S_OK;
}
STDMETHOD(Start Operation)(IBin dCtx *pbcReserved){
return S_OK;
}
....
}

and I call the DataObject as:

CComObject<PPDa taObject>* pDataObject;
//CComObject<>* pAsyncOp;
hr= CComObject<PPDa taObject>::Crea teInstance(&pDa taObject) ;
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 2694
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 CoMarshalInterT hreadInterfaceI nStream is one solution to try, if you
use the IStream interface for your data. Another is using the
IGlobalInterfac eTable interface.

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

Additionally, you may wish to post your question in the PlatformSDK.She ll
newsgroup as that newsgroup handles questions regarding NSE's and the
various Shell Interfaces.
"JDavide" <JD*****@discus sions.microsoft .comwrote in message
news:D1******** *************** ***********@mic rosoft.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 CComObjectRootE x<CComSingleThr eadModel>, public IDataObject, public
IAsyncOperation {
....
BEGIN_COM_MAP(P PDataObject)
COM_INTERFACE_E NTRY(IDataObjec t)
COM_INTERFACE_E NTRY(IAsyncOper ation)
END_COM_MAP()
...

STDMETHOD(EndOp eration)(HRESUL T hResult, IBindCtx* pbcReserved, DWORD
dwEffects){
return S_OK;
}
STDMETHOD(GetAs yncMode)(BOOL* pfIsOpAsync){
return VARIANT_TRUE;
}
STDMETHOD(InOpe ration)(BOOL *pfInAsyncOp){
*pfInAsyncOp=TR UE;
return S_OK;
}
STDMETHOD(SetAs yncMode)(BOOL fDoOpAsync){
return S_OK;
}
STDMETHOD(Start Operation)(IBin dCtx *pbcReserved){
return S_OK;
}
...
}

and I call the DataObject as:

CComObject<PPDa taObject>* pDataObject;
//CComObject<>* pAsyncOp;
hr= CComObject<PPDa taObject>::Crea teInstance(&pDa taObject) ;
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
3624
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 35%-60% complete. I'm sending large MP3 files from my website www.TheDoctorDementoShow.com but the users are pretty upset because the files are incomplete. I assume tis has something to do with headers or starting/stopping as the bandwidth...
1
7279
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 correctly and the other one transfers as a text field containing a number like 37917. In the spreadsheet both date cells are formatted as a date. The data in both fields are entered as dates (i.e. 10/27/03). The TransferSpreadsheet Command creates...
1
1583
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 computers. I need to update the data at the end of the night to reflect the changes on the particular database. So the data collected on computer1 needs to get to computer2 and the data on computer2 needs to get to computer1.
3
2761
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 (cluster) - normally this works fine. However, on the front end, another Unix system generates and transfers files to the DotNet application (Management system/controller) and recently I've witnessed the following: 1) Unix Box "A" generates data...
1
2257
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, or SQLServer) and imports it into a datatable and then on to the dataGridView for the user to see. The thing about that initial datasource is that the application will not know how its columns are formatted up until the data is actually sent...
9
1834
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 this problem. We have several client machines, and a central data warehousing server. Each machine may contain hundreds of surveys, and they all are sent to the central server. Only they can never be networked together, forcing us to use files. I...
7
1811
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 trying to implement an object that transfers ownership on assignment or copy, just like auto_ptr does. With an auto_ptr, I can do this: #include <string> #include <memory>
4
6411
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. My code looks as follows. #include <iostream>
4
5277
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 follows; Private Sub Command18_Click() Dim item
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.