C#: Control an external Explorer instance?

Status
Not open for further replies.

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
I've got an in-house app that requires a person to drag-drop various sound clip files into various text boxes.

The process follows rough guidelines, but is full of exceptions (hence the reason we have a human doing the actual matching).

There are two screens in the app that most of the time need files from known directories, and I'd like when the user opens one of those screens, an Windows Explorer window to open (unless already opened previously, then re-used) and show the files in the corresponding "most likely" directory. The window needs to act just like a normal windows explorer window (user can change directories, drag files, etc.), just needs to be able to have it's current directly reset by my app when I need to.

I've never done anything like this, so I don't even know what to Google for.

Is this possible? What API/classes/etc. do I need to look into to make this work? Bonus points for sample code.
 

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
gaijin":3qlm9p9n said:
I don't understand why the users need to drag/drop the files.

Can't you just use a file open dialog that allows multiple file selection? Then you can just pop it up with the correct directory as the default. And of course, the user can still navigate the file system through that dialog.
The user is matching 5-15 files by dragging them into multiple text boxes. There is no guarantee that any particular text box or file gets used in the matching process. This is a repetitious business process, so minimal clicking/keystrokes is key.
 

NickSuperb

Seniorius Lurkius
9
I think what you want is something like an ActiveX control.
Since your in a corporate environment(?) there may be some limitation as far as software policies are concerned. This could work in your favor if the standard browser is IE. However, if you're users aren't limited to IE check out ff-activex-host for Firefox

http://blogs.msdn.com/b/asiatech/archiv ... -in-c.aspx
 

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
ShuggyCoUk":382qard9 said:
there's a (IIRC) Vista onwards embedded explorer shell control you can run from managed code with the VistaAPI code pack.

You'd likely have to stick it in a trivial form to make it play ball with your requirements.

use the explorer browser control
This method worked out really well. That control is really nice, and very easy to use.

For the record, doing it this way does expose one of the ugly annoyances of WPF**: If you hold an instance of the form in the main window (needed so that I can go back and change directories when needed), and the user closes the window, there is no built in way to determine that the window has already been closed. I found it very annoying to have to manually add a boolean property of HasClosed that gets toggled to true in the OnClosing Event.


**I do like WPF, but it is frustrating that Microsoft put in 75% as many silly annoyances as they did awesome features and capabilities. In the end there is more good than bad, but the level of bad is pretty frustrating.
 
Status
Not open for further replies.