Memory Meter (B+) von ??? |
Hier ein kleines Beispiel zu der System & Speicher Library http://www.blitzforum.de/viewtopic.php?t=4940 [code:1:b00ce0b1a5] ; .lib "kernel32.dll" ; GlobalMemoryStatus(lpBuffer*) : "GlobalMemoryStatus" ; GetSystemInfo(lpSystemInfo*) : "GetSystemInfo" ; ;--------------------- function mem --- Type MEMORYSTATUS Field dwLength% Field dwMemoryLoad% Field dwTotalPhys% Field dwAvailPhys% Field dwTotalPageFile% Field dwAvailPageFile% Field dwTotalVirtual% Field dwAvailVirtual% End Type Global Memory.MEMORYSTATUS = New MEMORYSTATUS ;### Function Library Memory ### ; SysMem = physical systemmemory (physikalischer ArbeitsSpeicher) Function TotalSysMem() GlobalMemoryStatus(Memory) Return MemorydwTotalPhys End Function Function AvailSysMem() GlobalMemoryStatus(Memory) Return MemorydwAvailPhys End Function ; PageMem = paged memory of harddisk (ausgelagerter FestplattenSpeicher) Function TotalPageMem() GlobalMemoryStatus(Memory) Return MemorydwTotalPageFile End Function Function AvailPageMem() GlobalMemoryStatus(Memory) Return MemorydwAvailPageFile End Function ; VirtualMem = all memory of windows (komletter Speicher für Windows) Function TotalVirtualMem() GlobalMemoryStatus(Memory) Return MemorydwTotalVirtual End Function Function AvailVirtualMem() GlobalMemoryStatus(Memory) Return MemorydwAvailVirtual End Function ;------------------------------- window --- winw# = 120 winh# = 40 win = CreateWindow("4123123123",0,0,winw,winh,Desktop(),1+16) SetMinWindowSize win,winw,winh ;--- canw = ClientWidth(win) canh = ClientHeight(win) can = CreateCanvas(0,0,canw,canh,win) SetBuffer CanvasBuffer(can) ClsColor 0,255,0 Cls ;--- timer = CreateTimer(1) totalmem_sys = TotalSysMem() totalmem_page = TotalPageMem() ;--------------------- programm start --- While WaitEvent() Select EventID() Case $803 ; WindowClose End Case $4001 ; Timer availmem_sys = AvailSysMem() availmem_page = AvailPageMem() xscale_sys = winw - winw / totalmem_sys * availmem_sys xscale_page = winw - winw / totalmem_page * availmem_page SetGadgetText win, "free "+ availmem_sys Cls Color 250,0,0 Rect 0, 0, xscale_sys , canh/2, 1 Color 250,250,0 Rect 0, canh/2, xscale_page, canh/2, 1 FlipCanvas can End Select Wend [/code:1:b00ce0b1a5] |