Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New FAQ: Place file reference on clipboard 2

Status
Not open for further replies.

wgcs

Programmer
Mar 31, 2002
2,056
EC
Ever want a user to email a certain file from your application (eg, a data file), but have trouble getting across how to "browse" to find that file? How about just putting a reference to the file on the clipboard and letting them "Paste" it into an email (which attaches it to the email)?

This is tested with Eudora v5 and Outlook 2003 and works!

faq184-5743

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Bill,

Absolutely awesome - I would give you FIVE stars if I could!

This type of capability has been on my todo list for ages so finding your tip on this forum was like an early birthday present! :)

Now the tough question ... do you have any ideas how a VFP could read files pasted to the clipboard by other apps? In other words, continuing with your scenario - if a user copied an attachment from an email application to the clipboard, how could our VFP app recognize and process that file?

Also, does your tip work with multiple files or only a single file?

THANKS AGAIN!

Malcolm
 
Absolutely awesome - I would give you FIVE stars if I could!
Wow! Thanks!

Now the tough question ... do you have any ideas how a VFP could read files pasted to the clipboard by other apps? In other words, continuing with your scenario - if a user copied an attachment from an email application to the clipboard, how could our VFP app recognize and process that file?
Sure.
The main structure for my code came from this page: which illustrates how to use GetClipboardData to get RTF data off the clipboard... just get CF_HDROP instead.

Also, does your tip work with multiple files or only a single file?
It supports just one file at a time. :( Oh, wait, No it does support multiple files :)

My initial testing made me conclude that the Clip type needed to be "Shell IDList Array" to do multiple files... I now see that it doesn't: you can use "CF_HDROP" for multiple files, and therefore my code (without any changes at all :) ) simply by seperating the file names with CHR(0).

It puts a funky value into FileName and FileNameW, though: they only support one filename at a time. Fortunately, Email programs seem to use CF_HDROP. Maybe I'll adjust my faq to accept an array and behave properly, putting just the first file into "FileName" and "FileNameW"...


- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Ok, just for You: The FAQ184-5743 is now updated to put multiple files on the clipboard (correctly), when passed in as an array. You can still pass a single file as a character value.

This multi-file selection doesn't work with Outlook, though, which seems to reference the "Shell IDList Array" instead of CF_HDrop... oh well...

If anyone wants to inspect the actual contents of the clipboard, you'll see the same data is posted in several formats in order to increase the number of applications that will understand how to "paste" the data. This example program is a great tool, too, for viewing the clipboard:
- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Bill,

A million thanks!!! TOTALLY AWESOME! :)

Malcolm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top