开发者

Programatically invoking the default application for a filetype

开发者 https://www.devze.com 2023-01-07 22:08 出处:网络
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

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 do开发者_StackOverflowcs or the terminology to google for this.

Thanks,

Chris


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号