2

On a related note to this question, say I've got an file with an handler defined, how would I programatically invoke the registered handler? Don't necessarily need the actual code to do this, just a pointer to some docs or the terminology to google for this.

Thanks,

Chris

Community
  • 1
  • 1
cristobalito
  • 4,192
  • 1
  • 29
  • 41

2 Answers2

2

There's the ShellExecute function and its advanced cousin, ShellExecuteEx.

SirDarius
  • 41,440
  • 8
  • 86
  • 100
  • 1
    ShellExecute/Ex() is higher level then its lower-level cousins, FindExecutable() and CreateProcess...(). ShellExecute/Ex() is what the Shell uses in the `Start Menu | Run` field and when double-clicking the file in Windows Explorer. – Remy Lebeau Jul 20 '10 at 19:25
2

It is sufficent to start a new process specifying the file you want to open with the default application - the rest is handled by Windows. In C# this is done as follows.

Process.Start("Foo.jpg");

This will open the image using the default application for JPEG images.

Daniel Brückner
  • 59,031
  • 16
  • 99
  • 143