In the moment when a user right click a file and select=20
the option cut or copy, the file is sent to the clipboard
(portapapeles).The question is:
-=BFHow can i know wich of the options(cut or copy) has=20
select the user?

Thanks.

Re: Clipboard by Gabriele

Gabriele
Thu Nov 06 08:39:06 CST 2003

Hi,

The .NET class doesn't directly provide this information, however if you
check the clipboard for the "Preferred DropEffect" format you can get to it.

Public Enum DropEffects
Invalid
Move
Copy
Unknown
End Enum

Public Function PreferredDropEffect() As DropEffects

Dim d As IDataObject
Dim m As System.IO.MemoryStream
Dim o As Object

' retrieve data currently on the clipboard
d = Clipboard.GetDataObject()

' retrieve data associated with CFSTR_PREFERREDDROPEFFECT
o = d.GetData("Preferred DropEffect")

' check presence of CFSTR_PREFERREDDROPEFFECT data
If Not IsNothing(o) Then

' get MemoryStream object returned
m = o

' look at the first byte
Select Case m.ReadByte

' copy
Case 2
Return DropEffects.Copy

' move
Case 5
Return DropEffects.Move

' unknown drop effect
Case Else
Return DropEffects.Unknown

End Select

Else

' no CFSTR_PREFERREDDROPEFFECT available
Return DropEffects.Invalid

End If

End Function

Regards,

Gabriele