Home All Groups Group Topic Archive Search About

Get processes list problem (win 2000)

Author
14 Apr 2005 8:25 PM
Eran AMiel
Hi
I am trying to get the processes list from using the code attached.
In win xp it works great but in win 2000 i get only one process the idle
Any Ideas ?
The Code :

Dim Vec As System.Diagnostics.Process()
Dim V As Object = Diagnostics.Process.GetProcesses.GetEnumerator

            Vec = Diagnostics.Process.GetProcesses
            For Each V In Diagnostics.Process.GetProcesses
                ListBox1.Items.Add(CType(V, Diagnostics.Process).ProcessName)
            Next
--
Thank For The Help
Eran
--
Thank For The Help
Eran

Author
14 Apr 2005 8:51 PM
Crouchie1998
' Import
' -------

Imports System.Diagnostics

' Declaration
' ------------

Dim p As Process

' Behind a button:
' ----------------

ListBox1.BeginUpdate()
ListBox1.Items.Clear()

For Each p In Process.GetProcesses
    ListBox1.Items.Add(p.ProcessName)
Next

ListBox1.EndUpdate()

Crouchie1998
BA (HONS) MCP MCSE
Official Microsoft Beta Tester
Author
14 Apr 2005 11:15 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"Eran AMiel" <EranAM***@discussions.microsoft.com> schrieb:
> I am trying to get the processes list from using the code attached.
> In win xp it works great but in win 2000 i get only one process the idle
> Any Ideas ?
> The Code :
>
> Dim Vec As System.Diagnostics.Process()
> Dim V As Object = Diagnostics.Process.GetProcesses.GetEnumerator
>
>            Vec = Diagnostics.Process.GetProcesses
>            For Each V In Diagnostics.Process.GetProcesses
>                ListBox1.Items.Add(CType(V,
> Diagnostics.Process).ProcessName)
>            Next

I doubt that this code works on Windows XP.  Try this instead:

\\\
Imports System.Diagnostics
..
..
..
For Each p As Process In Process.GetProcesses()
    Me.ListBox1.Items.Add(p.ProcessName)
Next p
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
15 Apr 2005 3:09 AM
Crouchie1998
You duplicated my code Herfried.

Crouchie1998
BA (HONS) MCP MCSE
Official Microsoft Beta Tester
Author
15 Apr 2005 10:55 AM
Herfried K. Wagner [MVP]
"Crouchie1998" <crouchie1998@spamcop.net> schrieb:
> You duplicated my code Herfried.

Sorry, I don't see any message of you in this thread -- my OE deleted some
messages because they are not available on the server any more (although
they actually are...), maybe your message was one of them.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>