[.net] ShellExecuteEx API call in C#

Started by
11 comments, last by alvirtuoso 15 years, 11 months ago
you'll need to turn on ErrorDialog for openas to work
Advertisement
I'd suggest not bothering with these monitoring threads at all. Your manager knows the directory or directories containing the data it manages. So when the app loads, take a sort of picture of the directory with like an array of FileInfo classes. Then just check them all for changes in the AppActivate event or OnIdle or both.

Nobody wants to be hassled by a utility program everytime they do File/Save in photoshop. But if you must have the thing imposing itself on your users, you could use a timer as well. I wouldn't do it, though. Because if you make your app annoying, your users will try to subvert its operations by doing things like making local copies of work files that your app won't know about at all.

This way, it wont matter if the user launches the editor from your app or not. As long as they are altering files in the monitored directories, you manager will know about it.
Quote:Original post by Anonymous Poster
you'll need to turn on ErrorDialog for openas to work


Ano's detailed version would be:

// There is no application associated with the specified file
ProcessStartInfo psi = new ProcessStartInfo(filename);
psi.UseShellExecute = true; // u need this
psi.ErrorDialog = true; // and this which launch the OpenWith dialog
Process.Start(psi);

This topic is closed to new replies.

Advertisement