471,344 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,344 software developers and data experts.

IFileOpenDialog in C#

I was wondering if there are examples or a way of using IFileDialog and those
Classes that inherit from it, in C#. I have an application that I would like
to add functionality on the OpenFileDialog box, to give my users more
options. This is the only thing that I have found to allow customization of
the file dialog boxes.

Thanks,
usuenginerd
Jun 27 '08 #1
4 4811
On Mon, 02 Jun 2008 12:00:02 -0700, usuenginerd
<us*********@discussions.microsoft.comwrote:
I was wondering if there are examples or a way of using IFileDialog and
those
Classes that inherit from it, in C#. I have an application that I would
like
to add functionality on the OpenFileDialog box, to give my users more
options. This is the only thing that I have found to allow
customization of
the file dialog boxes.
As you probably already know, there's no "IFileOpenDialog" in .NET. That
name implies an interface, and the common dialog stuff is all just class
hierarchy. The IFileDialog and related interfaces are from the unmanaged
Windows API. In .NET, you have access to the common dialogs via the
FileDialog sub-classes (SaveFileDialog, OpenFileDialog), but they don't
provide an easy way to customize the dialog from .NET. It would probably
require use of some interop code (p/invoke) and maybe even mucking with
the FileDialog implementations (very messy and fragile to do).

I haven't seen anyone successfully customize the common file dialogs from
..NET. Which isn't to say it's not possible; just that I haven't seen any
sign that people are doing it. It's probably a lot easier to customize it
from the unmanaged Windows API, which is already set up for that sort of
thing (to some extent), and then use your customized version in a .NET
program (either through interop, or even by wrapping the unmanaged stuff
in a managed C++ class). In that way, you'd basically be making your own
FileDialog implementation that provides the customization features you
need.

Pete
Jun 27 '08 #2
It seems to me that Microsoft has a base dialog box and then they customize
it according to the operation. If you look in Office 2007 MSWord and look at
the differences from the 'Save As...' Dialog box and the 'Open' Dialog box
there are some noticable differences. I don't know how this is but it would
seem to me that the dialog boxes should be able to be customized. I guess
the other option that I have is to create a follow up dialog box to the
'Open' dialog box and allow the user to set some options there. This would
be a custom dialog box.

Thanks
Jun 27 '08 #3
On Mon, 02 Jun 2008 12:35:03 -0700, usuenginerd
<us*********@discussions.microsoft.comwrote:
It seems to me that Microsoft has a base dialog box and then they
customize
it according to the operation.
They do. I have first-hand experience with that, back when the common
dialogs were first introduced (early 90's), and yes...the _unmanaged_
common dialog API does provide for customization of the dialogs. But: you
are posting to the C# newsgroup, and on the whole discussions here are
either about questions specifically pertaining to the use of the C#
language (the charter of the newsgroup) or to the use of the .NET
Framework (a de facto extension of the charter by the community).

Via _managed_ code, customization of these dialogs is basically not done
AFAIK. It'd just be too much of a hassle.
If you look in Office 2007 MSWord and look at
the differences from the 'Save As...' Dialog box and the 'Open' Dialog
box
there are some noticable differences.
Even using the .NET SaveFileDialog and OpenFileDialog, there are some
noticable differences. That's why .NET offers the two (and why Windows
also offers the two, used by each of SaveFileDialog and OpenFileDialgo).
But, I doubt that Word is using .NET to show those dialog boxes. Surely
they are using the unmanaged API, and in that context customization is
much easier (but off-topic in this newsgroup).
I don't know how this is but it would
seem to me that the dialog boxes should be able to be customized. I
guess
the other option that I have is to create a follow up dialog box to the
'Open' dialog box and allow the user to set some options there. This
would
be a custom dialog box.
From the .NET standpoint, if you can adjust your UI to take into account
additional user input in that way, that would definitely be the easiest
approach.

If not, it's not that you can't do what you're asking. It's just that
this newsgroup won't be the best place for you to get advice on how to do
it. You'll be much better off doing the customization without .NET, and
asking questions about said customization in a newsgroup pertaining to the
unmanaged Windows API.

Pete
Jun 27 '08 #4
Thanks Pete for your help I will post this same question under a different
thread base.

usuenginerd
"Peter Duniho" wrote:
On Mon, 02 Jun 2008 12:35:03 -0700, usuenginerd
<us*********@discussions.microsoft.comwrote:
It seems to me that Microsoft has a base dialog box and then they
customize
it according to the operation.

They do. I have first-hand experience with that, back when the common
dialogs were first introduced (early 90's), and yes...the _unmanaged_
common dialog API does provide for customization of the dialogs. But: you
are posting to the C# newsgroup, and on the whole discussions here are
either about questions specifically pertaining to the use of the C#
language (the charter of the newsgroup) or to the use of the .NET
Framework (a de facto extension of the charter by the community).

Via _managed_ code, customization of these dialogs is basically not done
AFAIK. It'd just be too much of a hassle.
If you look in Office 2007 MSWord and look at
the differences from the 'Save As...' Dialog box and the 'Open' Dialog
box
there are some noticable differences.

Even using the .NET SaveFileDialog and OpenFileDialog, there are some
noticable differences. That's why .NET offers the two (and why Windows
also offers the two, used by each of SaveFileDialog and OpenFileDialgo).
But, I doubt that Word is using .NET to show those dialog boxes. Surely
they are using the unmanaged API, and in that context customization is
much easier (but off-topic in this newsgroup).
I don't know how this is but it would
seem to me that the dialog boxes should be able to be customized. I
guess
the other option that I have is to create a follow up dialog box to the
'Open' dialog box and allow the user to set some options there. This
would
be a custom dialog box.

From the .NET standpoint, if you can adjust your UI to take into account
additional user input in that way, that would definitely be the easiest
approach.

If not, it's not that you can't do what you're asking. It's just that
this newsgroup won't be the best place for you to get advice on how to do
it. You'll be much better off doing the customization without .NET, and
asking questions about said customization in a newsgroup pertaining to the
unmanaged Windows API.

Pete
Jun 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.