Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    C#: Make sure a process is running by its Directory.

    Hello, my program starts 2 programs.. From different directorys, but they both need to stay running ALL the time, so if one crashes I need my program to be able to start it up again, but the problem is that they are both the same program and come up in the process manager as the same thing.. But they actually do two different things.

    Edit: Oh yeah, and this is in C#

    So I need to be able to start the seperate ones

    Thanks and please help :d
    -Kenny
    Last edited by kennyb2142; 07-04-2009 at 12:09 AM. Reason: C#

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Try this:

    Code:
    Process[] procs;
    procs = Process.GetProcessesByName("OUTLOOK"); // put your process name here
    foreach (Process p in procs)
    {
        MessageBox.Show(p.MainModule.FileName); // for example...
    }
    Also, check out all the info you get with the Process class:
    http://msdn.microsoft.com/en-us/libr...s_members.aspx

    Good luck;


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •