1

I'd like to show a shell namespace extension in the new (since Windows Vista) IFileOpenDialog and IFileSaveDialog.

These dialogs can apparently display a custom form like the built-in Homegroup screen:

enter image description here

On this form I'd like to show internal files stored in a database (with various other options).

My question is: is it possible to pass the files that the users selects on my custom form to the IFileOpenDialog? And is it possible to let the user select a location in the database, then receive the files from the IFileSaveDialog and store them in the database?

Important! I understand that this would be possible if I implemented virtual folders and files with my shell namespace extension. But is it possible to have my own Form embedded into the shell and in the same time pass and receive files to/from the dialogs?

If it is possible, what methods do I need to implement in my shell extension to catch the dialog open/save events?

Steve
  • 2,510
  • 4
  • 34
  • 53
  • 1
    There are many different questions. Shell namespace extensions implement IShellFolder. What you call "form" is a "view", implemented by IShellView. Explorer provides a default one (the one that shows folders & items, virtual or not), but you can provide your own and provide any UI you want (you give an HWND). Common dialogs display basically the same as explorer, but they can be configured to filter virtual items (FOS_FORCEFILESYSTEM). Some apps don't show virtual items. To answer the question: you can display virtual items that the common dialogs pick, yes, but not for every app. – Simon Mourier Feb 16 '19 at 16:14
  • Do I understand correctly that like Explorer, common dialogs can also display a custom "view" implemented by IShellView (without using virtual items)? If that is so, how can I pass files to or receive files from the common dialog? (this is what I meant in the original question). What methods to I need to implement to "communicate" with the common dialogs? – Steve Feb 17 '19 at 18:44
  • You don't "communicate" with it. It communicates with you through standard Shell Namespace Extension interfaces (IShellFolder, IShellView, etc.). – Simon Mourier Feb 17 '19 at 19:34
  • I understand that and I have some example code for IShellFolder and IShellView. But what specific methods do I need to implement to send / receive files in the commond dialogs? – Steve Feb 17 '19 at 20:50
  • 1
    There's no notion of sending nor receiving files in common dialog. Common File Dialog can browse folders, items, and use views to select paths that's it. Please explain exactly what you mean by that, or what you are trying to achieve – Simon Mourier Feb 18 '19 at 08:01
  • I understand that normally the common dialog will work with a file path. You browse the path and it will open a file (or files) from there or save a file there. What I'm trying to achieve is that the user selects one or more files in my view (embedded into the dialog) from my program's database, and when the user clicks the open/save button in the common dialog, a temporary copy is created of those files, and the paths to these temporary files are passed to the dialog. So the question is how do I know when the save/open button is pressed and how do I pass the paths? – Steve Feb 18 '19 at 09:46
  • 1
    The common item dialog is controlled by the app that invokes it, not by the shell namespace. As a namespace extension, you cannot react to the fact you're being browsed by a common item dialog or something else. However, from the requirements you express, I have the impression that you may no need this. A namespace extension can have fully virtual items, or items backed by a physical path. It's when the app (not the common item dialog) requests those items that you can do some local copy actions. Still support may vary per app (Explorer, Notepad, Word, Paint3D, etc., they behave differently) – Simon Mourier Feb 18 '19 at 10:06
  • Now I'm starting to understand it. If I implement IShellView::GetItemObject to pass a temporary path to the common dialogs, I don't have to implement IShellFolder::BindToObject, EnumObjects, GetUIObjectOf, etc. - right? – Steve Feb 18 '19 at 23:46
  • Not quite. First, you should try to avoid implementing a custom IShellView. I suggest you just provide provide shell folders and shell items, virtual or not, and walk from there, see what's work for you and what doesn't. Then, if your shell items are fully virtual, you'll probably have to implement IStorage or IStream on shell item. Maybe it's all you need. – Simon Mourier Feb 19 '19 at 16:19
  • The program for which I'm implementing the namespace extension is a document management system. It has groups, matters within groups, folders and documents within matters and different document versions within documents. That is why I'd like to implement my own IShellView and not use the shell virtual folders and items (they are not enough to represent the above hierarchy). If I need to stick to IShellView, how do I go about providing my temporary files to the common dialogs? – Steve Feb 19 '19 at 22:57

0 Answers0