Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

Handling a running Process

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sravan_reddy001 - 24 Jun 2007 10:13 GMT
I want to handle a running process. ex:  explorer.exe

How can i handle that process(explorer.exe). and is it possilbe to
stop that process from runing.
Peter Bromberg [C# MVP] - 24 Jun 2007 12:03 GMT
// System.Diagnostics namespace
Process[] procs = Process.GetProcessesByName("EXPLORE");
       if (procs[0].Responding )   
       MessageBox.Show("EXPLORE is Responding");
    else
       MessageBox.Show("EXPLORE is Not Responding");
   else
    MessageBox.Show("EXPLORE is Not Running");
       if (procs[0].Responding)
           procs[0].CloseMainWindow();
       else
       procs[0].Kill();
    }
   catch
    {
    MessageBox.Show("Could Not Find the EXPLORE Process");
    }

-- Peter
Site:  http://www.eggheadcafe.com
UnBlog:  http://petesbloggerama.blogspot.com
Short urls & more:    http://ittyurl.net

> I want to handle a running process. ex:  explorer.exe
>
> How can i handle that process(explorer.exe). and is it possilbe to
> stop that process from runing.
Tom Spink - 24 Jun 2007 13:26 GMT
> // System.Diagnostics namespace
> Process[] procs = Process.GetProcessesByName("EXPLORE");
[quoted text clipped - 23 lines]
>> How can i handle that process(explorer.exe). and is it possilbe to
>> stop that process from runing.

Hi,

> Process[] procs = Process.GetProcessesByName("EXPLORE");
>         if (procs[0].Responding )

Just a quick observation, I think the code is missing an if clause.

Signature

Tom Spink
University of Edinburgh

sravan_reddy001 - 24 Jun 2007 17:03 GMT
private void Form1_Load(object sender, EventArgs e)
       {
           Process []p = Process.GetProcessesByName("Opera.exe");
           if (p.Length != 0)
           {
               if (p[0].Responding)
               {
                   label1.Text = "Explorer Responding";
                   //p[0].CloseMainWindow();
               }
               else
               {
                   label1.Text = "Explorer Not Responding";
                   //p[0].Kill();
               }
           }
           else
           {
               label1.Text = "Explorer not running";
           }

this is code i had given in my prog

the display is always "Explorer not running" i tried giving giving
different names but no result.
KWienhold - 25 Jun 2007 09:52 GMT
> private void Form1_Load(object sender, EventArgs e)
>         {
[quoted text clipped - 21 lines]
> the display is always "Explorer not running" i tried giving giving
> different names but no result.

If memory serves, the name of the process should be "Opera", not
"Opera.exe".

hth,
Kevin Wienhold
sravan_reddy001 - 25 Jun 2007 14:19 GMT
I gav the name opera, explorer and Explorer, explorer.exe and tried
many others.

the message is Explorer Not Running in the label1
Tom Spink - 25 Jun 2007 19:04 GMT
> I gav the name opera, explorer and Explorer, explorer.exe and tried
> many others.
>
> the message is Explorer Not Running in the label1

Hi,

Did you try: "EXPLORE"?

Signature

Tom Spink
University of Edinburgh

sravan_reddy001 - 26 Jun 2007 03:21 GMT
i tried....

when i tried for "svchost" i got the result...
but didn't got anthing about "Explorer"

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.