0

I'd like the standard windows open and save file dialogs, however, the particular application I am using it for is a remote file system (basically, I'd love to somehow just provide a IFileSystem interface to SaveFileDialog and have it magically change the files it sees by me providing them). Does anyone know of a complete implementation of those dialogs that supports this functionality? Is there any way to do it with the standard C#/windows dialogs?

If not, I will be implementing the dialog myself. I would still love any resources to implementations of these dialogs, even if they don't support this functionality, just so I could rip them apart and add that functionality myself.

Thanks!

Trevor Sundberg
  • 1,584
  • 1
  • 14
  • 25

2 Answers2

2

The only choice is to implement your own Shell Namespace Extension. It may be registered as a "My Computer" child so it looks like another drive. Beware: this is a tedious work and due to .NET framework limitation (<4.0), it has to be written in C/C++.

Here is the example.

dzendras
  • 4,721
  • 1
  • 25
  • 20
  • I thought the limitation pre 4.0 was just that you couldn't load different versions of the CLR side-by-side, so you could still write a managed extension, but it was stuck as running with whatever CLR might already be running in explorer? – James Manning May 14 '12 at 03:44
  • That's exactly the limitation I talk about. – dzendras May 14 '12 at 14:28
  • That looks like almost exactly what I'd want. Though ideally I couldn't browse anything else but that, I'll see if there's a way to hide everything else, or just reject files not from that location. Thanks for the link! – Trevor Sundberg May 14 '12 at 16:47
  • @dzendras - if that's the limitation, then you don't *have* to use C/C++, you're just limited to whatever CLR is already loaded. Most of the time, that means you can't use C#/CLR 4 because something else has already loaded the v2 CLR. Is that not the case? – James Manning May 14 '12 at 19:30
  • Yes it is. However if the application requires .NET 4.0 (or newer) then there is no problem: http://stackoverflow.com/questions/3053876/shell-extensions-with-net-4-0 – dzendras May 16 '12 at 05:40
1

These classes are very thin wrappers around calls to native Windows shell api functions. GetOpenFileName() for XP and earlier, the IFileOpenDialog COM interface for Vista and up. If you cannot see the file system in Explorer then those wrappers are not going to be useful at all.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536