ShellExecute

preetinagg
preetinagg used Ask the Experts™
on
Is there any pre-defined method which is equivalent of ShellExecute in VC++ or Shell in VB? Or an equivalent of CreateProcess? I want to open any file from inside C# code with application defined by file association. So a .doc file should be opened with Word.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
System.Diagnostics.Process.Start

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessClassStartTopic.asp

It looks like the third overload with only one string as a parameter, is the one you'd need for your application.
The above comment is comment but I just elaborate on this by providing the source. The points should be given to farsight :).

// C# Sample
using System;
using System.Diagnostics;

public class ShellExecuter
{
     public static void Main()
     {
          Process.Start("test.doc");
         
     }
}

Author

Commented:
Thanks ,
it worked.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial