Slenkar, you don't need to do anything with the actual kernel32.dll. You need to have/create a text file called user32.decls in your userlibs folder, put this in it, save it, then restart Blitz:
.lib "kernel32.dll" GlobalMemoryStatus%(lpBuffer*)
Here is another, perhaps easier to understand version of Eikon's program:
;===============================
;TotalSysMem() and AvailSysMem()
;===============================
;Two functions that use userlibs to access total and available system memory.
;To work, you need to add the following to your decls file in your userlib folder.
;.lib "kernel32.dll"
;GlobalMemoryStatus%(lpBuffer*)
;Reference
;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp
;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/memorystatus_str.asp
Print "TotalSysMem() = " + TotalSysMem() + " bytes"
Print "AvailSysMem() = " + AvailSysMem() + " bytes"
WaitKey()
End
;This function returns the available physical memory on the user's PC.
;This excludes virtual memory, which can be created on disk, and
;available video memory, which can be accessed using the Blitz AvailVidMem()
;command. The number returned is in bytes.
Function AvailSysMem()
bank = CreateBank (32)
GlobalMemoryStatus (bank)
mem = PeekInt (bank,12)
FreeBank bank
Return mem
End Function
;This function returns the total physical memory on the user's PC.
;This excludes virtual memory, which can be created on disk, and
;total video memory, which can be accessed using the Blitz TotalVidMem()
;command. The number returned is in bytes.
Function TotalSysMem()
bank = CreateBank (32)
GlobalMemoryStatus (bank)
mem = PeekInt (bank,8)
FreeBank bank
Return mem
End Function
|