Discussion:
how to programmatically invoke the "send to" dialog ?
(too old to reply)
R.Wieser
2023-07-27 07:19:51 UTC
Permalink
Hello all,

I've got a small program in which I would like to be able to invoke the
"send to" dialog. ComDlg32.dll doesn't seem to offer it, and a quick-ish
websearch returns all kinds of results, but not in the direction I need. :-\

Remark: I know that I can populate a listbox with the contents of the "send
to" folder (doing everything myself), but I really would like to be lazy and
just call the one thats already there. :-)

Regards,
Rudy Wieser
JJ
2023-07-27 11:30:13 UTC
Permalink
Post by R.Wieser
Hello all,
I've got a small program in which I would like to be able to invoke the
"send to" dialog. ComDlg32.dll doesn't seem to offer it, and a quick-ish
websearch returns all kinds of results, but not in the direction I need. :-\
Remark: I know that I can populate a listbox with the contents of the "send
to" folder (doing everything myself), but I really would like to be lazy and
just call the one thats already there. :-)
Regards,
Rudy Wieser
What "Send to" dialog? IIRC, there's no "Send to" dialog.

Since you're expecting it as a common dialog, you can use
`SHBrowseForFolder()` to only display the content of the "Send to" folder
(as the root folder display; so that users can't go to the parent folder),
and to only display files. Though, you still need to manually execute the
chosen file.
R.Wieser
2023-07-27 14:43:25 UTC
Permalink
JJ,
Post by JJ
What "Send to" dialog? IIRC, there's no "Send to" dialog.
Yeah, I stated that a bit off I'm afraid. Its the right-click -> "send to"
submenu I was talking about.
Post by JJ
Since you're expecting it as a common dialog, you can use
`SHBrowseForFolder()` to only display the content of the "Send to" folder
In my case that would also show a number if items I've suppressed (appended
an exclamation mark to the extension of some, and as such don't show up in
the "send to" context menu), which isn't quite what I have in mind.

Also, it would not show something like the "DVD-RW drive" entry (which must
have been put into the context menu by other means).

Thanks for the reply though. It looks like the lazy option doesn't exist.
:-( :-)

Regards,
Rudy Wieser
Auric__
2023-07-27 17:53:40 UTC
Permalink
Post by R.Wieser
JJ,
Post by JJ
What "Send to" dialog? IIRC, there's no "Send to" dialog.
Yeah, I stated that a bit off I'm afraid. Its the right-click -> "send
to" submenu I was talking about.
That's just a folder in the user's home directory, %USERPROFILE%\SendTo. (On
modern systems, that redirects to %APPDATA%\Microsoft\Windows\SendTo.) Grab
all files in that directory (except desktop.ini, of course) and use that to
build a menu, filtering out the ones you don't want to display. The clickable
text is the name of the file (sans extension) and for the action just invoke
the file directly.
--
I overclocked my mouse pad.
R.Wieser
2023-07-28 06:45:22 UTC
Permalink
Auric,
Post by Auric__
That's just a folder in the user's home directory, %USERPROFILE%\SendTo.
As mentioned in my prevous post here, not quite. The context dialog list
both has items that are not in that folder and vise-verse.
Post by Auric__
Grab all files in that directory (except desktop.ini, of course) and use
that to build a menu, filtering out the ones you don't want to display.
As remarked in my initial post I know that I can do that.

But I currently have little wish to re-create something if I can just use
something thats already there. Besides the issue of duplicating the
context-menu's filtering rules.

As for the "filtering", do you have any idea where an entry like "DVD-RW
(D:)" comes from ? Or how you would ultimatily invoke such an entry on the
provided file(s)/folder(s) ?

IOW, there is a good reason why I want to use the build-in method instead of
trying to build my own one.

Regards,
Rudy Wieser
Auric__
2023-07-28 17:53:36 UTC
Permalink
Post by R.Wieser
Auric,
Post by Auric__
That's just a folder in the user's home directory, %USERPROFILE%\SendTo.
As mentioned in my prevous post here, not quite. The context dialog list
both has items that are not in that folder and vise-verse.
Post by Auric__
Grab all files in that directory (except desktop.ini, of course) and use
that to build a menu, filtering out the ones you don't want to display.
As remarked in my initial post I know that I can do that.
But I currently have little wish to re-create something if I can just use
something thats already there. Besides the issue of duplicating the
context-menu's filtering rules.
As for the "filtering", do you have any idea where an entry like "DVD-RW
(D:)" comes from ? Or how you would ultimatily invoke such an entry on the
provided file(s)/folder(s) ?
IOW, there is a good reason why I want to use the build-in method instead
of trying to build my own one.
Sorry, I missed basically all of the above, else I wouldn't have posted. My
apologies.
--
That last statement alone pushes the story from "sad" to
"heartbreakingly tragic."
JJ
2023-07-28 04:50:14 UTC
Permalink
Post by R.Wieser
JJ,
Post by JJ
What "Send to" dialog? IIRC, there's no "Send to" dialog.
Yeah, I stated that a bit off I'm afraid. Its the right-click -> "send to"
submenu I was talking about.
Post by JJ
Since you're expecting it as a common dialog, you can use
`SHBrowseForFolder()` to only display the content of the "Send to" folder
In my case that would also show a number if items I've suppressed (appended
an exclamation mark to the extension of some, and as such don't show up in
the "send to" context menu), which isn't quite what I have in mind.
Also, it would not show something like the "DVD-RW drive" entry (which must
have been put into the context menu by other means).
Thanks for the reply though. It looks like the lazy option doesn't exist.
:-( :-)
The "Send to" context menu is handled by a built in shell extension. To
programmatically use it, your program will have to act like a shell explorer
which support shell extensions.

i.e. load the shell extension. Enumerate its menus. Then invoke the needed
menu.

Note: the shell extension must be initialized with the file/folder for the
shell extension to work with. Otherwise the shell extension may create the
incorrect set of menu items.
R.Wieser
2023-07-28 06:48:55 UTC
Permalink
JJ,
Post by JJ
Note: the shell extension must be initialized with the file/folder for
the shell extension to work with. Otherwise the shell extension may
create the incorrect set of menu items.
That would be a problem. I do not have /a/ folder, my items could come
from all over the place (multiple drives even).

Regards,
Rudy Wieser
JJ
2023-07-29 10:46:01 UTC
Permalink
Post by R.Wieser
JJ,
Post by JJ
Note: the shell extension must be initialized with the file/folder for
the shell extension to work with. Otherwise the shell extension may
create the incorrect set of menu items.
That would be a problem. I do not have /a/ folder, my items could come
from all over the place (multiple drives even).
The "Send to" context menu is applicable on multiple selections - even on
different drives or computer. i.e. multiple sources, one destination.

Thus, the source file(s)/folder(s) can came from multiple and different
folders/drives/computers. Like how the "Send to" menu is still applicable on
multiple selected items which are from Explorer find files (which returns
files from different folders/drives/computers).

From programmer's perspective, for a custom/predefined list of sources, we
can't use or rely on the "Explorer find" feature. The list will have to be
built manually.

Basically, you program will need to be a host process for a shell extension.
A process which specifically chooses which shell extension to use. Rather
than relying the shell component to do everything - which ends up not
providing any fine control to a host process.

Loading...