|
-
Oct 6th, 2004, 06:57 PM
#1
Thread Starter
Fanatic Member
Copy File To Clipboard {RESOLVED}
Ok,
I have a string filename:
c:\temp.jpg
*Could be any extension .jpg,.tiff,.txt,.php,.html...
I want to put this file in the clipboard as if I had right clicked on it in windows explorer and selected copy so that the user can later paste it elsewhere on their file system.
Does anybody have any clue as to how to do this with:
Clipboard.SetDataObject
Thanks in advance
Last edited by cpatzer; Oct 7th, 2004 at 06:40 PM.
In life you can be sure of only two things... death and taxes. I'll take death.
-
Oct 7th, 2004, 05:57 AM
#2
Hi
VB Code:
Dim DataObject As New DataObject
Dim file As String = "C:\TESTE.PDF"
DataObject.SetData(DataFormats.FileDrop, True, file)
Clipboard.SetDataObject(DataObject)
Regards
Jorge
"The dark side clouds everything. Impossible to see the future is."
-
Oct 7th, 2004, 11:33 AM
#3
Thread Starter
Fanatic Member
Jorge,
Did you test this on your machine?
It looks right, but won't work on my machine.
When I try to paste it into a folder or my desktop, I get the hour glass for a second but no file is pasted.
Thanks again
In life you can be sure of only two things... death and taxes. I'll take death.
-
Oct 7th, 2004, 11:51 AM
#4
Addicted Member
Did you try it with a .jpg or .txt file? I'm guessing you can't do with this with .pdf content ...
-
Oct 7th, 2004, 04:26 PM
#5
Hi Cpatzer
Your are correct using the windows explorer paste doesn't do anything but i tried
Clipboard.GetDataObject with both .pdf and .wav where copied the files on the destination directory.
Regards
Jorge
"The dark side clouds everything. Impossible to see the future is."
-
Oct 7th, 2004, 04:44 PM
#6
Thread Starter
Fanatic Member
Well, that is what I need, to be able to have the user then paste it wherever they want.
Any ideas?
In life you can be sure of only two things... death and taxes. I'll take death.
-
Oct 7th, 2004, 06:39 PM
#7
Thread Starter
Fanatic Member
Solution
Code:
Dim DataObject As New DataObject
Dim tempFileArray(0) As String
'NOTE THAT IT MUST BE PASSED AN ARRAY!!!
tempFileArray(0) = activeListView.SelectedItems(0).Tag
DataObject.SetData(DataFormats.FileDrop, False, tempFileArray)
Clipboard.SetDataObject(DataObject)
Thanks to all.
In life you can be sure of only two things... death and taxes. I'll take death.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|