0

I am trying to replace all Windows Common (Open/Save) filedialog calls with my own custom dialog. From what I read so far, I could do this with a hook on the calls either by writing my own or by using libraries like detours or easyhook. But someone told me recently that such an approach is only possible pre-Vista, because of the change in sessions architecture and it is impossible to do such a switch in Win 7/8. Now, I am not a guy who likes the word 'impossible' :) So if you have any advice on the matter, any at all, please do tell and I will appreciate your kindness.

For what I what to do, my application will be run by the user, it will reside in the tray, and when the user calls for Open/Save dialog from any application, it should replace the default common dialog with a custom dialog.

Prad Lal
  • 113
  • 7
  • Please, make this optional. At least some of your users will like the Windows-provided version better. – Ben Voigt Jul 30 '13 at 16:01
  • Have you ever done hooking before? – Ben Voigt Jul 30 '13 at 16:05
  • 2
    This is not supported. Not saying that it is impossible, just that it isn't supported. You are also entering the dangerous world of app compat, since apps do all sorts of crazy things to the common dialogs. For example, there are all of the CDM messages, CDN notifications, customization templates... – Raymond Chen Jul 30 '13 at 16:49
  • Oh boy... replacing explorer might be trivial compared to hooking the common dialogs. – Nik Bougalis Jul 30 '13 at 17:17
  • @BenVoigt : Thanks for your input. And no, I do not have experience with hooking. – Prad Lal Jul 31 '13 at 03:14
  • @RaymonChen : I'm a fan of yours, been reading your blog :) I do realize that different applications customize the common dialogs in different ways, may I ask if it is possible to look at the customization request and do the same to the custom dialog that I want to show. Again, very glad to see your reply. – Prad Lal Jul 31 '13 at 03:30

1 Answers1

4

The newer style Common Item dialogs are implemented as standard COM objects, so you could just implement your own DLL that exposes the same COM interfaces (IFileOpenDialog, IFileSaveDialog, etc) and then override the default registrations in the Registry with your own. That way, every app that uses the dialogs will load your DLL instead of Microsoft's.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • May I ask if this approach have any delayed complications. Like when the user installs newer programs or when the OS has an update ? – Prad Lal Jul 31 '13 at 03:51
  • Applications won't have any effect on it, but an OS update/repair might restore the default registration. – Remy Lebeau Jul 31 '13 at 05:49