Click here to Skip to main content
15,922,574 members
Home / Discussions / C#
   

C#

 
NewsRe: Reading varbinary(max) Pin
CodingLover28-Jan-09 22:13
CodingLover28-Jan-09 22:13 
GeneralRe: Reading varbinary(max) Pin
SeMartens28-Jan-09 22:17
SeMartens28-Jan-09 22:17 
NewsRe: Reading varbinary(max) Pin
CodingLover28-Jan-09 23:04
CodingLover28-Jan-09 23:04 
GeneralRe: Reading varbinary(max) Pin
SeMartens28-Jan-09 23:15
SeMartens28-Jan-09 23:15 
QuestionRe: Reading varbinary(max) Pin
CodingLover1-Feb-09 17:24
CodingLover1-Feb-09 17:24 
AnswerRe: Reading varbinary(max) Pin
SeMartens1-Feb-09 21:07
SeMartens1-Feb-09 21:07 
QuestionClose all application using c# Pin
sandhya1428-Jan-09 21:28
sandhya1428-Jan-09 21:28 
AnswerRe: Close all application using c# Pin
Ankit Rajpoot28-Jan-09 21:40
Ankit Rajpoot28-Jan-09 21:40 
GeneralRe: Close all application using c# Pin
sandhya1428-Jan-09 21:43
sandhya1428-Jan-09 21:43 
GeneralRe: Close all application using c# Pin
sandhya1428-Jan-09 21:58
sandhya1428-Jan-09 21:58 
GeneralRe: Close all application using c# Pin
SeMartens28-Jan-09 22:00
SeMartens28-Jan-09 22:00 
GeneralRe: Close all application using c# Pin
Ankit Rajpoot28-Jan-09 22:26
Ankit Rajpoot28-Jan-09 22:26 
GeneralRe: Close all application using c# Pin
SeMartens28-Jan-09 22:30
SeMartens28-Jan-09 22:30 
GeneralRe: Close all application using c# Pin
sandhya1428-Jan-09 22:41
sandhya1428-Jan-09 22:41 
GeneralRe: Close all application using c# Pin
SeMartens28-Jan-09 22:53
SeMartens28-Jan-09 22:53 
GeneralRe: Close all application using c# [modified] Pin
charles henington12-May-10 18:44
charles henington12-May-10 18:44 
GeneralRe: Close all application using c# Pin
Ankit Rajpoot28-Jan-09 22:59
Ankit Rajpoot28-Jan-09 22:59 
AnswerRe: Close all application using c# Pin
SeMartens28-Jan-09 21:43
SeMartens28-Jan-09 21:43 
GeneralRe: Close all application using c# Pin
sandhya1428-Jan-09 22:17
sandhya1428-Jan-09 22:17 
GeneralRe: Close all application using c# Pin
Ankit Rajpoot28-Jan-09 22:27
Ankit Rajpoot28-Jan-09 22:27 
GeneralRe: Close all application using c# Pin
sandhya1429-Jan-09 20:04
sandhya1429-Jan-09 20:04 
GeneralRe: Close all application using c# Pin
Ankit Rajpoot29-Jan-09 21:01
Ankit Rajpoot29-Jan-09 21:01 
GeneralRe: Close all application using c# Pin
sandhya1429-Jan-09 21:12
sandhya1429-Jan-09 21:12 
GeneralRe: Close all application using c# Pin
Ankit Rajpoot29-Jan-09 21:22
Ankit Rajpoot29-Jan-09 21:22 
GeneralRe: Close all application using c# Pin
Ankit Rajpoot29-Jan-09 21:49
Ankit Rajpoot29-Jan-09 21:49 
All right, try like this

void CloseApplications(void)
{
  string explorerPath = Path.GetDirectoryName(System.Environment.SystemDirectory);

         explorerPath = Path.Combine(explorerPath.ToLower(), "explorer.exe");

  Process[] processes = Process.GetProcesses();
  foreach(Process process in processes)
  {
      try
      {
           if (process.MainModule.FileName.ToLower() != explorerPath)
                process.CloseMainWindow();      
      }
      catch
      {
           // Handle exceptions here.
      }
  }
}


Excuse me for buttin' in, but I'm interrupt driven.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.