` Printed Icetips Article

Icetips Article



Windows API: Implement Send To
2006-06-14 -- Jim Kane
 
> I have a case where I can have multiple files in a directory, different
> format and, to complicate it, different extensions for the same filetype.
> Some  of these filetypes are easy, it is either CAD documents or PDF, but
> these simple ascii files with different extensions (R02, E1, wpd etc) that
> could have been opened in Notepad, can also be opened in a different
> program that reads the document easier. So, I can't assign the extension
> for ShellExecute to work.
> What I like, is to utilize the Explorer Send to menu and let the user
> select the program to run. I first thought I could use Directory() to get
> a list in the SendTo folder, but these are all shortcuts and while they
> run, I just can't make them take a parameter.
>
> Can this be done without too much hassle? Someone has a template or class
> that they are willing to share?

The general approach is to call
SHGetSpecialFolderLocation(CSIDL_SENDTO, pidl ) to get the folder.  Call
ShGetDesktopFolder() to get IShellFolderDesktop
and then call IShellFolderDesktop.BindToObject(pidl) to get an IShellfolder
interface for the send to folder.

Call IShellFolder.getuiobjectof() to get an IDropTarget interface then call
the IDropTarget methods to simulate a drop on the send to folder item of
your choice.  Probably about a page or two of code.

Jim Kane



Printed November 21, 2024, 11:30 am
This article has been viewed/printed 35205 times.
Google search has resulted in 7 hits on this article since January 25, 2004.