Snuggledash icon

available_ram.py

Snuggledash | PRO | 06/21/20 05:53:13 PM UTC | 0 ⭐ | 1542 👁️ | Never ⏰ | []
Python |

630 B

|

None

|

0 👍

/

0 👎

import locale, ctypes, struct
MEMORYSTATUSEX_SIZE = 64
MB_ICONINFORMATION = 0x40
 
locale.setlocale(locale.LC_NUMERIC, "")
 
buf = ctypes.create_string_buffer(MEMORYSTATUSEX_SIZE)
buf[0:4] = struct.pack("I", MEMORYSTATUSEX_SIZE)
if ctypes.windll.kernel32.GlobalMemoryStatusEx(buf):
    (memory_load,
    total_phys,
    avail_phys,
    total_pagefile,
    avail_pagefile,
    total_virtual,
    avail_virtual,
    avail_extended_virtual) = struct.unpack("xxxxIQQQQQQQ", buf)
    msg = locale.format_string("%d Bytes frei", avail_phys, grouping=True)
    ctypes.windll.user32.MessageBoxW(None, msg, "Info", MB_ICONINFORMATION)

Comments