473,395 Members | 1,688 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,395 software developers and data experts.

Support Clipboard correctly

Hello Netizens,

I have a .NET application that can do drag & drop files from/to Explorer.
All works fine - until I tried to implement clipboard support. The problem
is with cut and paste. I have read (and understood?) "Handling Shell Data
Transfer Scenarios" in MSDN,
http://msdn2.microsoft.com/en-us/library/aa969396.aspx

I set the clipboard like this:

StringCollection files = new StringCollection();
files.Add( ... some filename ... );

DataObject dataObject = new DataObject();
dataObject.SetFileDropList( files );

dataObject.SetData( ShellClipboardFormats.CFSTR_PREFERREDDROPEFFECT,
DragDropEffects.Move );

Clipboard.SetDataObject( dataObject );

After that, I can do a "paste" in Explorer, and the file system object is
moved to the new location - everything fine so far.

But I cannot get feedback in my program about the sucessful paste. I do not
know when to update my GUI. MSDN says that Explorer will put the format
CFSTR_PASTESUCCEEDED into the clipboard when the paste is finished.

I can observe that the shell has performed the move correctly, and I
conclude that the shell did correctly interpret the
CFSTR_PREFERREDDROPEFFECT format with value
DragDropEffects.Move.

I can also observe that the clipboard is not cleared after the paste (which
would be normal behavior when I do cut/paste between Explorers). In fact,
the clipboard remains completely unchanged after the paste - which, for
example, would allow another paste, which must fail, because the object is
no longer at its original location.

So, please, what is wrong here?
Greetz
Paule
Jul 26 '07 #1
0 1278

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

Similar topics

2
by: Gey-Hong Gweon | last post by:
Is there a way to copy a PIL image to windows clipboard (as a dib image or a bitmap, I suppose)? What I would like to accomplish is to do a fast copy and paste of images from my python...
0
by: Christopher | last post by:
Hello, First, I appologize for the length but I want to get all the facts down so as not to waste any time :) I'm trying to allow the user of my C# app to copy a DataGrid full of double values...
0
by: mhospodarsky | last post by:
Hi-- I am using VB.Net 2002 for this app. I am working with Tiff and jpeg images. I have a picturebox set up that I use to view the images. I have the picture box inside of a scrollable...
11
by: Andrey Dzizenko | last post by:
Hi all! Did anyone try the subj? I use extern IsClipboardFormatAvailable and GetClipboardData from user32.dll. IsClipboardFormatAvailable(14) returns true, but GetClipboardData(14)...
1
by: Robert Bravery | last post by:
Hi all, I'm using the following code to copy data from XL to the clipboard to be later usied in a datatable range = objSheet.get_Range("A22", "aa100"); range.Copy(Missing.Value).ToString();...
5
by: exhuma.twn | last post by:
As many might know, windows allows to copy an image into the clipboard by pressing the "Print Screen" button on the keyboard. Is it possible to paste such an image from the clipboard into a "Text"...
2
by: Alexander Gorbylev | last post by:
Hi! Let the size of vector is e.g. 3.5". I render the same vector on a printer & a screen on the same procedure: printDoc_BeginPrint(object sender, PrintEventArgs e) { .... vector.Width *...
2
by: Fade | last post by:
In my app, I use clipboard to paste some html text into ppt. The program runs correctly in VS2005 development server, and IIS 5.1 in WinXP SP2. But it failed on WinServer 2003. The thread blocks...
20
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject = Clipboard.GetDataObject() If...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.