The Sandbox Post

Single Post Permalink

View Thread: Vista style file dialogs for .Net 2.0
  • User profile image
    Sven Groot

    littleguru wrote:
    Wow! This is sweet. You mention some hooks that needed to be installed to get all the functionality the current .NET classes provide. By using the new dialogs, those hooks are no longer required?

    Yes, that's the case.

    .Net's own file dialog classes use the old API (naturally), and they must use a dialog hook. For example, the dialogs fire the FileOk event (which is a cancellable event) when the user clicks OK. With the old API, there is no way to determine when the OK button is pushed without using a hook. It is because .Net uses a hook that it gets the old dialogs, because the new dialogs don't support hooks. If you use the old API without using hooks, you get the new dialogs, but for .Net this is impossible if you want to preserve all functionality.

    The new API is completely different from the old one. It provides far more powerful ways to customize the dialog, and it also provides a proper event model (in the COM way so an event interface that needs to be implemented on an event sink object which is then registered with the dialog). This is what I used to replicate the additional functionality. It's really a very nice API (the only drawback is that it's hell to interop with due to the lack of a type library and the use of handle values).