Public Class Form1
<DllImport("coredll.dll")> Private Shared Function GetSystemMemoryDivision( _
ByRef lpdwStorePages As Integer, _
ByRef ldpwRamPages As Integer, _
ByRef ldpwPageSize As Integer) As Integer
End Function
<DllImport("coredll.dll")> Private Shared Function SetSystemMemoryDivision( _
ByVal dwStorePages As Integer) As Integer
End Function
Public Shared Sub SetMemory(ByVal division As Integer)
Dim storePages, ramPages, pageSize, totalPages As Integer
If GetSystemMemoryDivision(storePages, ramPages, pageSize) = 1 Then
totalPages = storePages + ramPages
storePages = CInt(totalPages * (100 - division) / 100)
Call SetSystemMemoryDivision(storePages)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Set Memory 90%
SetMemory(90)
End Sub
End Class