[ Simke @ 12.10.2003. 22:18 ] @
Kako da u VB.Net dobijem informacije o memoriji (total sys mem, available mem, itd...)?
[ degojs @ 12.10.2003. 23:08 ] @
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:)
[ Simke @ 13.10.2003. 00:33 ] @
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
[ dotnet @ 13.10.2003. 00:47 ] @
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")
[ Simke @ 13.10.2003. 02:28 ] @
Hvala puno, ovo je pomoglo.