Solved

how to get  all information of task manager using vb.net

Posted on 2009-06-29
7
1,625 Views
Last Modified: 2012-06-27
i want to obtain the total physical memory and available physical memory
which is display on task manager in performance tab and the list of process with memory usage which is currently running on the task manager in process tab in vb.net application


0
Comment
Question by:mrpatil
  • 4
  • 3
7 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 24742832
To retrieve the process-information, you need something like this:
Dim poc() as process = process.getprocesses()
for i as integer = 0 to poc.length - 1
if poc(i).processname.tostring <> "system" or poc(i).processname.tostring <> "idle" then
try
lstview.items.add(environment.machinename)
lstview.items(i).subitems.add(poc(i).processname)
lstview.items(i).subitems.add(poc(i).mainmodule.filename)
lstview.items(i).subitems.add(poc(i).mainwindowtitle)
catch ex as exception
msgbox(poc(i).processname.tostring & " " & ex.message)
end try
end if
next 

Open in new window

0
 

Author Comment

by:mrpatil
ID: 24763156
this code not give the specific running process list and available and total physical memory
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 24763328
Memory usage
------------------

Dim p As Process
For Each p In p.GetProcesses
  lblMemUsage.Text = p.ToString.Remove(0, 27).ToLower & " " & (p.WorkingSet / 1024).ToString("0,000") & " K"
Next
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 53

Expert Comment

by:Dhaest
ID: 24763334
VB.Net: Getting memoryusage of one process
http://wiki.lessthandot.com/index.php/VB.Net:_Getting_memoryusage_of_one_process
Public Shared Function GetMemoryUsage(ByVal ProcessName As String) As String 
            Dim _Process As Process = Nothing 
            Dim _Return As String = "" 
            For Each _Process In Process.GetProcessesByName(ProcessName) 
                If _Process.ToString.Remove(0, 27).ToLower = "(" & ProcessName.ToLower & ")" Then 
                    _Return = (_Process.WorkingSet64 / 1024).ToString("0,000") & " K" 
                End If 
            Next 
            If Not _Process Is Nothing Then 
                _Process.Dispose() 
                _Process = Nothing 
            End If 
            Return _Return 
        End Function

Open in new window

0
 

Author Comment

by:mrpatil
ID: 24763478
this code not give available physical size & total physical size(i.e. display on the task manager in performance tab)
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 24763553
You'll need to take several small examples of code together to get all that you want. I don't think that there is already a tool available that has all the things that you want...

Some things you can use to recreate the taskmanager
Memory Monitor (VB.NET 1.1)
http://www.freevbcode.com/ShowCode.asp?ID=5920

Process-tab: Examples given above
Memory-information:
http://www.java2s.com/Code/VB/Windows-System/Gettotalmemory.htm
http://vbnet.mvps.org/index.html?code/system/globalmemory.htm
0
 

Author Closing Comment

by:mrpatil
ID: 31598232
now please give the list of process which are running in the task manager with name of process and use of cpu and memory
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question