Click here to Skip to main content
16,007,277 members
Home / Discussions / C#
   

C#

 
GeneralRe: kill proccess with C# Pin
crash89331-May-07 11:19
crash89331-May-07 11:19 
GeneralRe: kill proccess with C# Pin
Christian Graus31-May-07 11:26
protectorChristian Graus31-May-07 11:26 
GeneralRe: kill proccess with C# Pin
Tarakeshwar Reddy31-May-07 12:37
professionalTarakeshwar Reddy31-May-07 12:37 
GeneralRe: kill proccess with C# Pin
crash89331-May-07 19:24
crash89331-May-07 19:24 
GeneralRe: kill proccess with C# Pin
crash89331-May-07 20:01
crash89331-May-07 20:01 
AnswerRe: kill proccess with C# Pin
Martin#31-May-07 20:20
Martin#31-May-07 20:20 
GeneralRe: kill proccess with C# Pin
crash89331-May-07 20:46
crash89331-May-07 20:46 
GeneralRe: kill proccess with C# Pin
Martin#31-May-07 21:02
Martin#31-May-07 21:02 
Hello,

OK, So you are entering the loop, that means he found an instance.
So whats the problem now?

crash893 wrote:
im not sure what you mean by dispose():

where would i put that and why. im not trying to dispose a proccess that has been created by me

Disposing frees the memory from any connections, so that the GarbadgeCollector (GC) can free the memory.
With the GetProcessesByName method you created an instance (or more) of the process class (Has nothing to to with creating an new winword instance).
You would also have to (or should) dispose the instances if you don't kill the process.

In your code this would mean:
foreach (System.Diagnostics.Process proc in System.Diagnostics.Process.GetProcessesByName(textBox1.Text))
{
    proc.CloseMainWindow();
    proc.WaitForExit(10000);
    if (!proc.HasExited)
    {
        proc.Kill();
    }
    proc.Dispose();
} 


All the best,

Martin
GeneralRe: kill proccess with C# Pin
crash8933-Jun-07 14:58
crash8933-Jun-07 14:58 
AnswerRe: kill proccess with C# Pin
Martin#10-Jun-07 20:07
Martin#10-Jun-07 20:07 
GeneralRe: kill proccess with C# Pin
crash89311-Jun-07 1:13
crash89311-Jun-07 1:13 
GeneralRe: kill proccess with C# Pin
Martin#11-Jun-07 1:19
Martin#11-Jun-07 1:19 
GeneralRe: kill proccess with C# Pin
crash89311-Jun-07 4:32
crash89311-Jun-07 4:32 
GeneralRe: kill proccess with C# Pin
Martin#11-Jun-07 19:23
Martin#11-Jun-07 19:23 
GeneralRe: kill proccess with C# Pin
crash89312-Jun-07 5:50
crash89312-Jun-07 5:50 
AnswerRe: kill proccess with C# Pin
blackjack215031-May-07 20:59
blackjack215031-May-07 20:59 
GeneralRe: kill proccess with C# Pin
Martin#31-May-07 21:06
Martin#31-May-07 21:06 
GeneralRe: kill proccess with C# Pin
crash8931-Jun-07 4:49
crash8931-Jun-07 4:49 
GeneralRe: kill proccess with C# Pin
Martin#1-Jun-07 8:21
Martin#1-Jun-07 8:21 
GeneralRe: kill proccess with C# Pin
crash8931-Jun-07 8:25
crash8931-Jun-07 8:25 
QuestionHow to install Microsoft Indexing Services automatically Pin
Muhammad Nauman Yousuf31-May-07 10:05
Muhammad Nauman Yousuf31-May-07 10:05 
QuestionGeneral C# Questions Pin
Revant Jain31-May-07 9:16
Revant Jain31-May-07 9:16 
AnswerRe: General C# Questions Pin
PIEBALDconsult31-May-07 9:19
mvePIEBALDconsult31-May-07 9:19 
GeneralRe: General C# Questions Pin
Revant Jain31-May-07 9:22
Revant Jain31-May-07 9:22 
QuestionDataGrid Object Location Pin
Expert Coming31-May-07 9:02
Expert Coming31-May-07 9:02 

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.