Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ? 
Author Message
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?

Env : NT4 SP 4, VC++

Hi,

is there a way to check which function (either "copy" or "cut") was used
when a user highlights one or several files and cuts/copies them to the
clipboard ? The files are then stored in CF_HDROP format within the
clipboard and I can extract them one by one, but how do I distinguish
between "copy" and "cut" ? has this something to do with the DROPEFFECT_...
constants ?

Any suggestion is highly appreciated.

Thanks in advance,

Joerg



Fri, 04 Jun 2004 23:27:25 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?


Quote:
> Env : NT4 SP 4, VC++

> Hi,

> is there a way to check which function (either "copy" or "cut") was used
> when a user highlights one or several files and cuts/copies them to the
> clipboard ? The files are then stored in CF_HDROP format within the
> clipboard and I can extract them one by one, but how do I distinguish
> between "copy" and "cut" ? has this something to do with the
DROPEFFECT_...
> constants ?

> Any suggestion is highly appreciated.

As far as I know, the answer is "no". A basic question for you is "Why do
you need or want to know?".

--
Jay



Sat, 05 Jun 2004 01:18:28 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?

Quote:
> > is there a way to check which function (either "copy" or "cut") was used
> > when a user highlights one or several files and cuts/copies them to the
> > clipboard ?
> As far as I know, the answer is "no". A basic question for you is "Why do
> you need or want to know?".

Hi Jay,

there MUST be a way to determine this :)

I just want to re-implement the Explorer's "Paste" facility (with special
features).

Scenario as follows :

- user highlights several files or folders and says either "copy" or "cut"
- instead of doing the "paste" process with the Windows explorer I want to
run my program
- the program would then extract file/folder name from the Clipboard and
then run ShFileOperation() with additional parameters, but needs to
distinguish between "copy" and "cut"

That's my intention here, hope that clarifies what I'm going to achieve ....

Greetings from Germany,

Joerg



Sat, 05 Jun 2004 01:54:18 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?

Quote:
> > is there a way to check which function (either "copy" or "cut") was used
> > when a user highlights one or several files and cuts/copies them to the
> > clipboard ?
> As far as I know, the answer is "no". A basic question for you is "Why do
> you need or want to know?".

Hi Jay,

there MUST be a way to determine this :)

I just want to re-implement the Explorer's "Paste" facility (with special
features).

Scenario as follows :

- user highlights several files or folders and says either "copy" or "cut"
- instead of doing the "paste" process with the Windows explorer I want to
run my program
- the program would then extract file/folder name from the Clipboard and
then run ShFileOperation() with additional parameters, but needs to
distinguish between "copy" and "cut"

That's my intention here, hope that clarifies what I'm going to achieve ....

Greetings from Germany,

Joerg



Sat, 05 Jun 2004 01:54:28 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?
On Mon, 17 Dec 2001 18:54:18 +0100, "Joerg Schultze-Lutter"

Quote:
>Scenario as follows :

>- user highlights several files or folders and says either "copy" or "cut"
>- instead of doing the "paste" process with the Windows explorer I want to
>run my program
>- the program would then extract file/folder name from the Clipboard and
>then run ShFileOperation() with additional parameters, but needs to
>distinguish between "copy" and "cut"

You don't make clear exactly what program is used to allow the user to
select "copy" vs "cut".  You also don't make clear what program is
used to extract the info from the clipboard and that must know which
it was.  If they are both your program then it is easy.  Just set a
flag.  If they are different programs, then you can't.  The clipboard
doesn't know how the stuff got there.  Beside, I can copy and then
immediately delete the files and get the same result as a cut.


Sat, 05 Jun 2004 02:25:46 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?


Quote:
> > > is there a way to check which function (either "copy" or "cut") was
used
> > > when a user highlights one or several files and cuts/copies them to
the
> > > clipboard ?
> > As far as I know, the answer is "no". A basic question for you is "Why
do
> > you need or want to know?".

> Hi Jay,

> there MUST be a way to determine this :)

> I just want to re-implement the Explorer's "Paste" facility (with special
> features).

> Scenario as follows :

> - user highlights several files or folders and says either "copy" or "cut"
> - instead of doing the "paste" process with the Windows explorer I want to
> run my program
> - the program would then extract file/folder name from the Clipboard and
> then run ShFileOperation() with additional parameters, but needs to
> distinguish between "copy" and "cut"

In general terms, "Paste" is enabled by something being in the clipboard.
The clipboard has no idea how the data got there. It doesn't even have to
come from "copy" or "cut". Any program can open the clipboard and put data
there whenever it wants.

"Cut" is often implemented as "copy" followed by delete. However, there are
notable exceptions (e.g. Excel, where "cut" doesn't delete the selected
cells until the "paste" is done - more like a "move", IMO).

Since your only access point is the clipboard, you really have no way of
knowing who, why, or how the data got there (unless you put it there
yourself). I would wager it's tricky if not nearly impossible (I qualify it
since the system knows on some level for delayed rendering) to even know
which app put the data on the clipboard.

Since you still haven't described how the behavior would differ for "copy"
vs. "cut", I can't offer a workaround or alternate suggestion. The one thing
to keep in mind is that the copy/cut behavior is at the discretion of the
app that places the data on the clipboard. The pasting app shouldn't do
anything to the source data (e.g. you should be able to paste data/files
into as many different apps as you want). The data placed on the clipboard
is the property of the cut/copy app, not the pasting one.

HTH
--
Jay



Sat, 05 Jun 2004 02:33:56 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?
Hi Joerg,
The clipboard format CFSTR_PREFERREDDROPEFFECT
is what you are looking for.
So for Cut you could test for DROPEFFECT_MOVE
and for Copy DROPEFFECT_COPY.

HTH
Philip


Quote:
> > > is there a way to check which function (either "copy" or "cut") was
used
> > > when a user highlights one or several files and cuts/copies them to
the
> > > clipboard ?
> > As far as I know, the answer is "no". A basic question for you is "Why
do
> > you need or want to know?".

> Hi Jay,

> there MUST be a way to determine this :)

> I just want to re-implement the Explorer's "Paste" facility (with special
> features).

> Scenario as follows :

> - user highlights several files or folders and says either "copy" or "cut"
> - instead of doing the "paste" process with the Windows explorer I want to
> run my program
> - the program would then extract file/folder name from the Clipboard and
> then run ShFileOperation() with additional parameters, but needs to
> distinguish between "copy" and "cut"

> That's my intention here, hope that clarifies what I'm going to achieve
....

> Greetings from Germany,

> Joerg



Sat, 05 Jun 2004 06:30:40 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?


Quote:
> Hi Joerg,
> The clipboard format CFSTR_PREFERREDDROPEFFECT
> is what you are looking for.
> So for Cut you could test for DROPEFFECT_MOVE
> and for Copy DROPEFFECT_COPY.

"Cool stuff!" he said a little sheepishly, as he struggled to put out the
blaze caused by his own flaming igorance.

--
Jay



Sat, 05 Jun 2004 06:55:28 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?


Wed, 18 Jun 1902 08:00:00 GMT  
 Clipboard and Explorer : how to distinguish betwwen "Copy"/"Cut" ?
This was EXACTLY what I was looking for !!!! Again, thank you very much !

Joerg



Sat, 05 Jun 2004 07:01:08 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. "cutting" a string

2. Source code for unix "Cut" utility

3. TreeView "cut" not exactly right

4. remove() vrs fopen("""w")

5. Displaying binary data as ascii "1"'s and "0"'s

6. Looking for "Shroud"/"Obfus"

7. ""help with TSR""

8. Parse trees and "("")"

9. Error "free"-ing "malloc"-ed memory

10. Displaying binary data as ascii "1"'s and "0"'s

11. Implementing "Windows Explorer"

12. Supressing "Internet Explorer Script Error" dialog

 

 
Powered by phpBB® Forum Software