views:

752

answers:

3

Is there a way of changing/adding to the windows Open/Save common dialog to add extra functionality?

At work we have an area on a server with hundreds of 'jobfolders'- just ordinary windows folders created/managed automatically by the database application to house information about a job (emails/scanned faxes/Word docs/Spreadsheets/Photos etc) The folders are named by the job Number.

I would like to expand the standard open/save dialog with a combobox which searches for jobfolders based on tags from the database, so that whatever my users are doing they can easily find their way to the correct jobfolder to find/save their work

Connecting to the database and providing the functionality to search is no problem, but is there a way to add a combobox control (ideally with a keypress/keydown event) to the dialog?

Or Create my own dialog and have it called/used in place of the standard one? i.e. from ANY app my dialog would be called allowing easy access to the jobfolders. If they are in outlook they can find a jobfolder quickly, if there are using Notepad they can still find the folder easily.

This would mean a new unified way of finding jobfolders from any app.

Ideally someone would know a way using VB/VB.net/C# but I'm guessing, if its possible, its probably going to be C++.

A: 

Your program can set the starting folder, so if you know the job number (and therefor the name of the folder), you can set the dialog to start out with the correct folder already opened. Beyond that I don't think you can do much without writing an entire shell extension for it.

Joel Coehoorn
A: 

The relevant Microsoft documentation for the Windows API is here:
http://msdn.microsoft.com/en-us/library/ms646960(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms646839(VS.85).aspx

Look particularly at the OFN_ENABLETEMPLATE and OFN_ENABLEHOOK flags.

As you say, this information is mostly relevant when you're working in C/C++.

Mark Ransom
+2  A: 

Like Mark Ransom said, you can do it with the OFN ENABLETEMPLATE and OFN ENABLEHOOK flags. You then specify a Dialog Resource to the lpTemplateName data member of the OPENFILENAME structure. Getting the placement of your controls right takes a bit of trial and error.

The hook procedure that you write will receive window messages specific to that dialog - you're particularly interested in the WM_NOTIFY messages - there's a bunch of special ones (CDN INITDONE, CDN FOLDERCHANGE, etc).

I've created some pretty elaborate ones a few times, I wish I could include a screenshot.

Marc Bernier
Thanks this looks good!I've set up hooks for catching mouse events and keystrokes before.Could you explain what the basic steps are i.e.Where does my code reside? will it be a dll somewhere?Is there a way to do it using VisualStudio.Net 2003 or SharpDevelop?Thanks
ajp