Run Application

hi,

as you all know, I have a reputation for making a text editor with extra functions. I'm continuing with this fancy text editor, and am now asking if it is possible to run other applications using my program and C#

eg. As you all know, MS Word is the biggest text editor made. I want to add some word art to my RTB, but can't do it in my own editor. How do I run MS Word using my application so I can add it

Thanks.

Eragon.




Answer this question

Run Application

  • stronc


    System.Diagnostics.Process.Start(@"pathToYourExe/exeFile.exe");

    Regards.



  • JohDas

    just to add, you can also use the assistant ProcessStartInfo class to customize how the application you are going to execute should be ran, example:

  • running in a different user account

  • changing the way it starts up such as creating no window or minimizing the process when it starts up

  • redirecting its input and output messages to your app

    etc...

    http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.processstartinfo.aspx



  • becko

    Hi,

    Thanks for all those hyperlinks, but I'm not sure you understood exactly what I meant. What I mean is, when you open Windows Picture and Fax Manager, there is a toolbar button that's tool-tip-text states: "Closes this program and opens the image for editing". Then it opens MS Paint, with the picture. The first reply showed me how to open the application (in this case, MS Word), but didn't show me how to open the application AND the file as one (ie. I click Open in MS Word, and it opens MS Word along with the selected file.) How do you do this

    Thanks.

    Eragon.



  • Law Ninja

    well it depends on the application.

    some applications allow a parameter to be added which will contain the path and filename to open

    others don't but if the file is registered with Windows Shell, then you can directly open it. Example, to open a word doc, assuming you have MS Word installed:

    Process.Start("path\myDoc.doc");

    which will open the document automatically. you may also get away with doing this:

    Process.Start("winword path\myDoc.doc");

    which would open MS Word and give it the path to the file you want to open.



  • John Perks

    There are 2 things in your question:

    1) Run an application from your code like you open Internet Explorer from your application like this:

    System.Diagnostics.Process.Start("iexplorer.exe");

    You need to specify full path of exe in order to run that!

    2) You are talking about Word art in your application. Its a little bit complex to achieve. These article would help you:

    http://www.codeproject.com/cs/miscctrl/richtextboxplus.asp

    http://www.codeproject.com/csharp/winwordloader.asp

    http://www.codeproject.com/cs/miscctrl/MyExtRichTextBox.asp

    Insert Images in RichTextBox

    http://www.codeproject.com/cs/miscctrl/csexrichtextbox.asp

    Text Effect and Highliting in RichTextBox:

    http://www.codeproject.com/vb/net/richtextboxhs.asp

    Completely dedicated to help your work:

    http://www.codeproject.com/vb/net/WordProcessingPackage.asp

    http://www.codeproject.com/cs/miscctrl/TabText.asp

    I hope if you have a look on all these articles you'll not face any problem from basic Text fomartting, Encoding and then printing of your documents!

    Best Regards and Best of Luck!



  • Run Application