Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Memory info u VB.NET

[es] :: .NET :: .NET Desktop razvoj :: Memory info u VB.NET

[ Pregleda: 3071 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Simke
Marko Simic
Sandfield Associates (Solution
Developer)
Novi Zeland

Član broj: 1158
Poruke: 751
*.avenue.co.nz

ICQ: 71578686
Sajt: www.sandfield.co.nz


Profil

icon Memory info u VB.NET12.10.2003. u 22:18 - pre 249 meseci
Kako da u VB.Net dobijem informacije o memoriji (total sys mem, available mem, itd...)?
All beer is good. Some beer is better.
 
Odgovor na temu

degojs

Član broj: 4716
Poruke: 5096



+51 Profil

icon Re: Memory info u VB.NET12.10.2003. u 23:08 - pre 249 meseci
Ne znam da li u .NET postoji klasa koja daje ovakve informacije, ali možeš da iskoristiš Win32 API ako ništa drugo.
http://www.vb-helper.com/howto_system_memory.html

/edit

U stvari, može i iz .NET. Pogledaj ovde.

//edit:
A tek ovo.. http://www.codeproject.com/csharp/wmi.asp?target=memory%7Cinfo

Pozdrav:)
Commercial-Free !!!
 
Odgovor na temu

Simke
Marko Simic
Sandfield Associates (Solution
Developer)
Novi Zeland

Član broj: 1158
Poruke: 751
*.avenue.co.nz

ICQ: 71578686
Sajt: www.sandfield.co.nz


Profil

icon Re: Memory info u VB.NET13.10.2003. u 00:33 - pre 249 meseci
Hvala na odgovoru.
Ovo sa vb-helper sam vec probao, ali mi daje run time error "Object reference not set to an instance of an object" kada pokusam da koristim mem u GetMemory().
Ne vidim sta radim pogresno. Pokusao sam i sa
Dim mem As MEMORYSTATUS = New MEMORYSTATUS
ali i dalje isto.
Ona druga 2 primera su C#, koji za sada jos ne znam:)


Private Structure MEMORYSTATUS
Public dwLength As Long ' Size of MEMORYSTATUS
Public dwMemoryLoad As Long ' % of memory in use
Public dwTotalPhys As Long ' Total bytes of physical memory
Public dwAvailPhys As Long ' Bytes of free physical memory
Public dwTotalPageFile As Long ' Bytes in paging file
Public dwAvailPageFile As Long ' Free bytes in paging file
Public dwTotalVirtual As Long ' User bytes of address space
Public dwAvailVirtual As Long ' Free user bytes
End Structure

Private Declare Sub GlobalMemoryStatus Lib "kernel32" (ByVal lpBuffer As MEMORYSTATUS)

Private Function GetMemory() As String
Dim mem As MEMORYSTATUS = New MEMORYSTATUS
Dim txt As String

'ovde daje gresku
GlobalMemoryStatus(mem)

With mem
txt = txt & "% used: " & _
Format$(.dwMemoryLoad, "@@@@@@@@@@@") & vbCrLf
txt = txt & "Total physical memory: " & _
Format$(.dwTotalPhys, "@@@@@@@@@@@") & vbCrLf
txt = txt & "Physical memory free: " & _
Format$(.dwAvailPhys, "@@@@@@@@@@@") & vbCrLf
txt = txt & "Total page file size: " & _
Format$(.dwTotalPageFile, "@@@@@@@@@@@") & _
vbCrLf
txt = txt & "Free page file size: " & _
Format$(.dwAvailPageFile, "@@@@@@@@@@@") & _
vbCrLf
txt = txt & "Total virtual memory: " & _
Format$(.dwTotalVirtual, "@@@@@@@@@@@") & vbCrLf
txt = txt & "Free virtual memory: " & _
Format$(.dwAvailVirtual, "@@@@@@@@@@@") & vbCrLf
End With

Return txt
End Function
All beer is good. Some beer is better.
 
Odgovor na temu

dotnet
Beograd

Član broj: 4344
Poruke: 112
*.vdial.verat.net

Jabber: dotnet@elitesecurity.org


Profil

icon Re: Memory info u VB.NET13.10.2003. u 00:47 - pre 249 meseci
Pozdrav

Evo ga primer:

1. Dodaj referencu na System.Management

2.
Code:
Imports System.Management


3.
Code:
        Dim memoryClass As New ManagementClass("Win32_OperatingSystem")
        Dim memory As ManagementObjectCollection = memoryClass.GetInstances()
        Dim memoryEnumerator As ManagementObjectCollection.ManagementObjectEnumerator = memory.GetEnumerator()
        memoryEnumerator.MoveNext()
        MessageBox.Show("System has " & Convert.ToString(memoryEnumerator.Current.Properties("FreePhysicalMemory").Value) & " K free physical memory")
        MessageBox.Show("System has " & Convert.ToString(memoryEnumerator.Current.Properties("TotalVisibleMemorySize").Value) & " K total physical memory")
        MessageBox.Show("System has " & Convert.ToString(memoryEnumerator.Current.Properties("FreeVirtualMemory").Value) & " K free virtual memory")
        MessageBox.Show("System has " & Convert.ToString(memoryEnumerator.Current.Properties("TotalVirtualMemorySize").Value) & " K total virtual memory")

dotnet
 
Odgovor na temu

Simke
Marko Simic
Sandfield Associates (Solution
Developer)
Novi Zeland

Član broj: 1158
Poruke: 751
*.avenue.co.nz

ICQ: 71578686
Sajt: www.sandfield.co.nz


Profil

icon Re: Memory info u VB.NET13.10.2003. u 02:28 - pre 249 meseci
Hvala puno, ovo je pomoglo.
All beer is good. Some beer is better.
 
Odgovor na temu

[es] :: .NET :: .NET Desktop razvoj :: Memory info u VB.NET

[ Pregleda: 3071 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.