Тогда это точно работает:
Add(MainForm,2953706,21,105)
{
Caption="Memory info"
Position=1
}
Add(Button,10504036,217,203)
{
Left=15
Top=10
Caption="Get info"
link(onClick,14624672:doEvent1,[])
}
Add(InlineCode,11970995,301,203)
{
WorkPoints=#17:doGetInstalledMem|14:doGetMemStatus|
EventPoints=#14:onInstalledMem|8:onStatus|13:onErrorStatus|
VarPoints=#10:MemoryLoad|9:TotalPhys|9:AvailPhys|13:TotalPageFile|13:AvailPageFile|12:TotalVirtual|12:AvailVirtual|
DataPoints=#5:Data1|5:Data2|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|4:uses|29: Windows, KOL, Share, Debug;|0:|0:|4:type|17: UInt64 = Int64;|2: |2: |33: TMemoryStatusEx = packed record|20: dwLength: DWord;|24: dwMemoryLoad: DWord;|25: ullTotalPhys: UInt64;|25: ullAvailPhys: UInt64;|29: ullTotalPageFile: UInt64;|29: ullAvailPageFile: UInt64;|28: ullTotalVirtual: UInt64;|28: ullAvailVirtual: UInt64;|36: ullAvailExtendedVirtual: UInt64;|6: end;|37: PMemoryStatusEx = ^TMemoryStatusEx;|0:|0:|29: THiAsmClass = class(TDebug)|11: private|34: FMemStatus: TMemoryStatusEx;|10: public|30: Data1, Data2: THI_Event;|32: onInstalledMem: THI_Event;|26: onStatus: THI_Event;|34: onErrorStatus: THI_Event; |65: procedure doGetInstalledMem(var _Data: TData; Index: Word);|62: procedure doGetMemStatus(var _Data: TData; Index: Word);|6: |58: procedure MemoryLoad(var _Data: TData; Index: Word);|57: procedure TotalPhys(var _Data: TData; Index: Word);|57: procedure AvailPhys(var _Data: TData; Index: Word);|61: procedure TotalPageFile(var _Data: TData; Index: Word);|61: procedure AvailPageFile(var _Data: TData; Index: Word);|60: procedure TotalVirtual(var _Data: TData; Index: Word);|60: procedure AvailVirtual(var _Data: TData; Index: Word);|6: end;|2: |106: function GlobalMemoryStatusEx(var lpBuffer: TMemoryStatusEx): Boolean; stdcall; external 'kernel32.dll';|2: |3:var|100: GetPhysicallyInstalledSystemMemory: function(var TotalMemoryInKilobytes: Int64): Boolean; stdcall;|0:|0:|0:|0:|0:|0:|0:|14:implementation|0:|0:|0:|0:|0:|0:|0:|71:procedure THiAsmClass.doGetInstalledMem(var _Data: TData; Index: Word);|3:var|13: Mem: Int64;|10: R: Real;|5:begin|12: Mem := -1;|2: |54: if Assigned(GetPhysicallyInstalledSystemMemory) then|44: GetPhysicallyInstalledSystemMemory(Mem);|11: R := Mem;|2: |45: _hi_CreateEvent(_Data, @onInstalledMem, R);|4:end;|0:|0:|69:procedure THiAsmClass.doGetMemStatus(var _Data: TData; Index: Word); |3:var|10: R: Real;|5:begin|49: FMemStatus.dwLength := SizeOf(TMemoryStatusEx);|42: if GlobalMemoryStatusEx(FMemStatus) then|7: begin|33: R := FMemStatus.ullTotalPhys;|43: _hi_CreateEvent(_Data, @onStatus, R); |5: end|6: else|68: _hi_CreateEvent(_Data, @onErrorStatus, Integer(GetLastError)); |2: |4:end;|0:|0:|64:procedure THiAsmClass.MemoryLoad(var _Data: TData; Index: Word);|5:begin|53: dtInteger(_Data, Integer(FMemStatus.dwMemoryLoad));|4:end;|0:|63:procedure THiAsmClass.TotalPhys(var _Data: TData; Index: Word);|3:var|10: R: Real;|5:begin|31: R := FMemStatus.ullTotalPhys;|19: dtReal(_Data, R);|4:end;|1: |63:procedure THiAsmClass.AvailPhys(var _Data: TData; Index: Word);|3:var|10: R: Real;|5:begin|31: R := FMemStatus.ullAvailPhys;|19: dtReal(_Data, R);|4:end;|0:|67:procedure THiAsmClass.TotalPageFile(var _Data: TData; Index: Word);|3:var|10: R: Real;|5:begin|35: R := FMemStatus.ullTotalPageFile;|19: dtReal(_Data, R);|4:end;|0:|67:procedure THiAsmClass.AvailPageFile(var _Data: TData; Index: Word);|3:var|10: R: Real;|5:begin|35: R := FMemStatus.ullAvailPageFile;|19: dtReal(_Data, R);|4:end;|0:|66:procedure THiAsmClass.TotalVirtual(var _Data: TData; Index: Word);|3:var|10: R: Real;|5:begin|34: R := FMemStatus.ullTotalVirtual;|19: dtReal(_Data, R);|4:end;|0:|66:procedure THiAsmClass.AvailVirtual(var _Data: TData; Index: Word);|3:var|10: R: Real;|5:begin|34: R := FMemStatus.ullAvailVirtual;|19: dtReal(_Data, R);|4:end;|0:|0:|0:|0:|22:procedure PrepareFunc;|3:var|16: hDLL: THandle;|5:begin|38: hDLL := LoadLibrary('kernel32.dll');|19: if hDLL <> 0 then|7: begin|42: GetPhysicallyInstalledSystemMemory := |65: GetProcAddress(hDLL, 'GetPhysicallyInstalledSystemMemory');|6: end;|4:end;|0:|14:initialization|14: PrepareFunc;|0:|4:end.|
link(onInstalledMem,8042298:doStrCat,[])
link(onStatus,2671137:doString,[(382,216)(382,245)(289,245)(289,272)])
}
Add(Label,3038234,462,203)
{
Left=15
Top=40
Width=85
Height=17
Caption="Installed memory:"
}
Add(Label,4512740,392,266)
{
Left=15
Top=70
Width=160
Height=130
Caption="Memory status:"
AutoSize=1
}
Add(Hub,14624672,266,203)
{
link(onEvent1,11970995:doGetInstalledMem,[])
link(onEvent2,11970995:doGetMemStatus,[])
}
Add(StrCat,8042298,420,203)
{
Str1="Installed memory (KB): "
link(onStrCat,3038234:doText,[])
}
Add(FormatStr,2671137,301,266)
{
DataCount=7
Mask="Memory status:\r\n\r\nMemoryLoad: %1\r\nTotalPhys: %2\r\nAvailPhys: %3 \r\nTotalPageFile: %4\r\nAvailPageFile: %5\r\nTotalVirtual: %6\r\nAvailVirtual: %7"
link(onFString,4512740:doText,[])
link(Str1,11970995:MemoryLoad,[])
link(Str2,11970995:TotalPhys,[])
link(Str3,11970995:AvailPhys,[])
link(Str4,11970995:TotalPageFile,[])
link(Str5,11970995:AvailPageFile,[])
link(Str6,11970995:TotalVirtual,[])
link(Str7,11970995:AvailVirtual,[])
}
doGetInstalledMem - работает только на Windows Vista и более новых.