CODICE
Global $GUI_EVENT_CLOSE = -3
If Not FileExists(@scriptdir&"\Reduce-Memory.bmp") Then InetGet("http://fileinternealt.altervista.org/_altervista_ht/Reduce-Memory.bmp",@ScriptDir&"\Reduce-Memory.bmp")
$Form1 = GUICreate("Memory Reduce", 609, 184, 0, 0)
GUICtrlCreatePic(@scriptdir&"\Reduce-Memory.bmp",0,0,609,184)
GUICtrlSetState(-1,128)
$Button1 = GUICtrlCreateButton("Info", 16, 128, 91, 33, 0)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button2 = GUICtrlCreateButton("Riduci Memoria ( All Process)", 160, 128, 163, 33, 0)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Button3 = GUICtrlCreateButton("Riduci Memoria ( Process specified )", 368, 128, 211, 33, 0)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000000)
$Input1 = GUICtrlCreateInput(Random(0,4000,1), 392, 48, 121, 21)
$Label1 = GUICtrlCreateLabel("Pid of process ( for view look TaskManager )", 376, 24, 215, 17)
GUICtrlSetBkColor(-1,-2)
$Progress1 = GUICtrlCreateProgress(8, 56, 329, 33)
$Group1 = GUICtrlCreateGroup("Manual", 352, 8, 249, 169)
GUICtrlSetBkColor(-1,-2)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
$mem=MemGetStats()
$perc_ram=GUICtrlCreateLabel("Percentage of Ram in use: %",90,92)
GUICtrlSetbkcolor(-1,-2)
$perc_ram2 = GUICtrlCreateLabel($mem[0],225,92)
GUICtrlSetBkColor(-1,-2)
$string = "RAM: "&@CR
For $i = 0 To 6
$string = $string&@CR&($mem[$i]*1024)
Next
While 1
$mem=MemGetStats()
If GUICtrlRead($Perc_ram2)<>$mem[0] Then GUICtrlSetData($perc_ram2,$mem[0])
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
MsgBox(64,"Info:", "Reduce Memory č stato creato da Gianlu-thebest e Gigi 32")
Case $Button2
$msg = MsgBox(32+4,"Continue?","Continue?")
If $msg = 6 Then
GUICtrlSetLimit($Progress1,15000,1)
For $i = 0 To 5000
_ReduceMemory($i)
GUICtrlSetData($Progress1,($i/500)*10)
$perc = Execute(($i/5000)*1000)
ToolTip("Progress: "&$i&" of "&5000)
If GUIGetMsg() = -3 Then Exit
Next
MsgBox(32,"Complete!","Operation Complete!",2)
GUICtrlSetData($Progress1,0)
ToolTip("")
EndIf
Case $Button3
$iPID = GUICtrlRead($Input1)
_ReduceMemory($iPid)
MsgBox(32,"Complete!","Operation Complete!",2)
Case $Label1
Run("taskmgr.exe")
EndSwitch
WEnd
Func _ReduceMemory($i_PID = -1)
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc;==> _ReduceMemory()