Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NewBie Question: Calling NOTEpad from my app !!help 1

Status
Not open for further replies.

ridifvx

Programmer
Apr 10, 2003
34
ID
HI i try to learn C# right now

uhm basic question
iF in VB NET there are shell() command to execute other *.exe in Windows system directory and VCPP has
Winexec() to call other executable file what function in Visual C# to do equal action

Help me please..with samples :)

I know is silly Question but 2 hours i read MSDN and still got NO CLUE

(yeah i should buy a C# books but in my country there are NO BOOK about Visual C#)

// HELP..i just want call notepad from my apllication :( //
 
Example 1:
try
{
//string m_FilePathToOpen ="...";
System.Diagnostics.Process vProcess=new System.Diagnostics.Process();
vProcess.EnableRaisingEvents =false;
vProcess.StartInfo.FileName= "notepad.exe";
//vProcess.StartInfo.Arguments= m_FilePath;
vProcess.Start();
}
catch (Exception e)
{
//
}
Example 2:
string WorkingDirectory = "C:\\Applications";
try
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WorkingDirectory = WorkingDirectory;
p.StartInfo.FileName = WorkingDirectory + "\\" + "my.exe";
p.StartInfo.Arguments = " ..."; // build here the arguments
p.EnableRaisingEvents = true; // if you want to capture events
p.StartInfo.UseShellExecute = false;
p.Exited += new EventHandler(captureOut);
p.Start();
}
catch(Exception exProcess)
{
}

private void captureOut(object sender, EventArgs e)
{
System.Diagnostics.Process ps = (System.Diagnostics.Process) sender;
// ...
}
-obislavu-
 
How can i say........................
Thank You very much..:)
U gave me more than i expect
 
Hi,
One rule of this forum is to give as much we can the right answer and the answer must be clear, refer to subject ....
I like to give examples thinking it could useful.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top