redirecting error of an external application to a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • taffer23
    New Member
    • Mar 2008
    • 7

    #1

    redirecting error of an external application to a form

    ok i want to write a c# program for rapidshare ,the purpose of this program is to restart rapidshare when it raises an error message,(that i cant get rid off.)so i need to put a handle on the rapidshare download manager and as soon as rapidshare raises the error message,the application should close rapidshare and relaunch it again.so i want to know how to put a handle on the rapidshare program so that i can take the appropriate action
    this is a code i wrote,i got the name of the program that is rapidshare
    using System;
    using System.Collecti ons.Generic;
    using System.Componen tModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows. Forms;
    using System.Diagnost ics;
    using System.Runtime;
    using System.Runtime. InteropServices ;

    namespace WindowsApplicat ion1
    {
    public partial class Form1 : Form
    {

    public Form1()
    {
    InitializeCompo nent();
    }

    private void Form1_Load(obje ct sender, EventArgs e)
    {
    runningpro();

    }
    public void runningpro()
    {
    string name; int i = 0;

    Process[] proc;
    proc = Process.GetProc esses();
    foreach (Process procs in proc)
    {
    name = procs.ProcessNa me;
    procs.Refresh() ;


    if (name == "RapidShareMana ger")
    {

    MessageBox.Show ("rapidshare is open is open");

    }}
    }

    private void button1_Click(o bject sender, EventArgs e)
    {
    runningpro();

    }

    }
    }
Working...