Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to replace the system open file dialog?

I want to replace the standard system open file dialog with the one I wrote, that means no matter within which programs you are opening a file, my dialog will be shown instead of the standard one, is this possible?

It seems that that there is no such API provided to accomplish this, is it possible to use some hooking technique, but this has to be reliable and not to be treated as spyware by anti-virus tools?

any other options?

If this is not possible, is it possible to add to the spacebar or toolbar in the standard open file dialog a button which invokes my dialog, which allow users select a file and in turn returns the path of the selected file to the "File name" input box of the standard dialog?

Any hits, links and code examples will be appreciated.

like image 571
Edwin Yip Avatar asked Jun 09 '09 04:06

Edwin Yip


2 Answers

Starting in Vista, the FileOpen/FileSave dialogs are now "Common Item Dialogs" of which IFileOpenDialog & IFileSaveDialog are the two published implementations.

Since they're just COM objects with known CLSIDs you might get away with just replacing them by re-registering using their CLSIDs. Never tried something like that, might trip all sorts of alarm bells.

Pre-Vista file dialogs can be hooked in process, but I've never come across anything about global hooks or equivalent.

like image 200
Kevin Montrose Avatar answered Nov 18 '22 18:11

Kevin Montrose


If you copy a file/folder to a dialog's filename field it usually pastes the full path anyway.

For example, if you have open both a program calling the standard open/save dialog box and also have a window open at the file or path that you want to work with (open from/save to), you can simply copy the file/folder from the explorer window, and then paste into the filename field of the dialog box, and it will insert the full path of the file/folder. No custom script is required!

Alternatively, for those programs that use custom dialog boxes where this step fails, copy the same file/folder in the window into the address bar of the same window (assuming it is visible). This will paste the full path, which you can copy again, and then paste this full path into the custom dialog box. I often use this when creating Office hyperlinks (Ctrl+K), because the Insert Hyperlink dialog does not work for the first method.

You can also use similar methods but paste into address bar fields and it works.

like image 37
Ark Avatar answered Nov 18 '22 18:11

Ark