Click here to Skip to main content
15,912,457 members
Home / Discussions / C#
   

C#

 
QuestionError Pin
NaNg1524111-Feb-06 3:54
NaNg1524111-Feb-06 3:54 
AnswerRe: Error Pin
perlmunger11-Feb-06 7:15
perlmunger11-Feb-06 7:15 
GeneralRe: Error Pin
NaNg1524111-Feb-06 8:13
NaNg1524111-Feb-06 8:13 
GeneralRe: Error Pin
NaNg1524111-Feb-06 9:36
NaNg1524111-Feb-06 9:36 
GeneralRe: Error Pin
perlmunger11-Feb-06 11:09
perlmunger11-Feb-06 11:09 
QuestionCreate list with Grid and getting Process info in C#. Pin
Yanshof11-Feb-06 1:37
Yanshof11-Feb-06 1:37 
AnswerSome one can help me with this question please ? Pin
Yanshof11-Feb-06 9:02
Yanshof11-Feb-06 9:02 
AnswerRe: Create list with Grid and getting Process info in C#. Pin
Dave Kreskowiak11-Feb-06 10:51
mveDave Kreskowiak11-Feb-06 10:51 
First, if you post a question in the forum, you better be patient waiting for an answer. We don't get paid to do this since The Code Project is entirely a volunteer effort. On top of that, you asked a question on the weekend! Hmmm | :|

To answer your first question, a ListView control will do everything you appear to be specifying, but in one control. It'll look just like the list in the Task Manager.

As for getting the path to the process, you need to get the MainModule of the Process, then you can use the FileName property of the module. Be prepared to handle some exceptions though. YOu can't get the Filename for the System or Idle processes.
For Each proc As Process In Process.GetProcesses()
    Try
        Debug.WriteLine(String.Format("{0} - {1}", proc.ProcessName, proc.MainModule.FileName))
    Catch ex As Exception
        Debug.WriteLine(String.Format("{0} - N/A", proc.ProcessName))
    End Try
Next

Damn! Wrong forum again!! Here's the C# version:
foreach (Process proc in Process.GetProcesses())
{ 
    try
    { 
        Debug.WriteLine(string.Format("{0} - {1}", proc.ProcessName, proc.MainModule.FileName)); 
    }
    catch (Exception ex)
    { 
        Debug.WriteLine(string.Format("{0} - N/A", proc.ProcessName)); 
    } 
}




RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome


-- modified at 16:52 Saturday 11th February, 2006
QuestionHow to browse SQL server from a network? Pin
bouli10-Feb-06 21:46
bouli10-Feb-06 21:46 
AnswerRe: How to browse SQL server from a network? Pin
perlmunger11-Feb-06 6:34
perlmunger11-Feb-06 6:34 
QuestionI need Help Pin
BestArtemis10-Feb-06 21:22
BestArtemis10-Feb-06 21:22 
AnswerRe: I need Help Pin
Wayne Phipps10-Feb-06 21:35
Wayne Phipps10-Feb-06 21:35 
QuestionDLL Problem Pin
Expert Coming10-Feb-06 14:06
Expert Coming10-Feb-06 14:06 
AnswerRe: DLL Problem Pin
Dave Kreskowiak10-Feb-06 14:28
mveDave Kreskowiak10-Feb-06 14:28 
GeneralRe: DLL Problem (How?) Pin
Expert Coming10-Feb-06 14:33
Expert Coming10-Feb-06 14:33 
GeneralRe: DLL Problem (How?) Pin
Dave Kreskowiak10-Feb-06 14:56
mveDave Kreskowiak10-Feb-06 14:56 
GeneralRe: DLL Problem (How?) Pin
kourvoisier10-Feb-06 14:59
kourvoisier10-Feb-06 14:59 
GeneralRe: DLL Problem (How?) Pin
Expert Coming10-Feb-06 15:09
Expert Coming10-Feb-06 15:09 
GeneralRe: DLL Problem (How?) Pin
Dave Kreskowiak10-Feb-06 16:50
mveDave Kreskowiak10-Feb-06 16:50 
GeneralRe: DLL Problem (How?) Pin
Expert Coming10-Feb-06 17:09
Expert Coming10-Feb-06 17:09 
GeneralRe: DLL Problem (How?) Pin
Dave Kreskowiak10-Feb-06 17:25
mveDave Kreskowiak10-Feb-06 17:25 
GeneralRe: DLL Problem (How?) Pin
Expert Coming10-Feb-06 17:32
Expert Coming10-Feb-06 17:32 
Question2 question about C#.... Pin
Yanshof10-Feb-06 12:37
Yanshof10-Feb-06 12:37 
AnswerRe: 2 question about C#.... Pin
Expert Coming10-Feb-06 13:03
Expert Coming10-Feb-06 13:03 
AnswerRe: 2 question about C#.... Pin
Sean8910-Feb-06 13:16
Sean8910-Feb-06 13:16 

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.