Hi all
In an application I wrote sometime ago, I need to add this for documenting purposes:
- the total amount of ram memory installed (for example 8 gb or 8192 mb or whatever)
AND
(the total _free_ ram memory available OR the total _used_ ram memory)
I don't need the amount of memory used by the application - I can play with the memory(...) function for that.
Something like the windows task manager shows when invoked - no matter the windows version (and by now, no need to know all the details task manager shows, i.e. the applications-running list).
Is there a way to get this under xharbour?
Preferably by code, not invoking a command line utility.
Best regards
--
Claudio Voskian
Buenos Aires - Argentina
El miércoles, 28 de junio de 2023 a la(s) 16:34:21 UTC-3, CV escribió:Hi
Hi all
In an application I wrote sometime ago, I need to add this for documenting purposes:
- the total amount of ram memory installed (for example 8 gb or 8192 mb or whatever)
AND
(the total _free_ ram memory available OR the total _used_ ram memory)
I don't need the amount of memory used by the application - I can play with the memory(...) function for that.
Something like the windows task manager shows when invoked - no matter the windows version (and by now, no need to know all the details task manager shows, i.e. the applications-running list).
Is there a way to get this under xharbour?
Preferably by code, not invoking a command line utility.
Best regardsHi
--
Claudio Voskian
Buenos Aires - Argentina
I just noticed that I will not find the total memory because I'm using a 32 bit application, and will not see the real total (more than 4 gb in this case, 32 gb in the client machine).
Please, disregard my request.
Regards
©
// bofFor me it works fine!
function main()
? "total", TOTALMEMORY(), "used", USEDMEMORY(), "free", FREEMEMORY() // all in bytes
return nil
#pragma BEGINDUMP
#include <windows.h>
HB_FUNC( TOTALMEMORY ) {
MEMORYSTATUSEX st;
st.dwLength = sizeof(st);
GlobalMemoryStatusEx(&st);
hb_retnll( ( LONGLONG ) st.ullTotalPhys);
}
HB_FUNC( USEDMEMORY ) {
MEMORYSTATUSEX st;
st.dwLength = sizeof(st);
GlobalMemoryStatusEx(&st);
hb_retnll( ( LONGLONG ) st.ullTotalPhys - st.ullAvailPhys);
}
HB_FUNC( FREEMEMORY ) {
MEMORYSTATUSEX st;
st.dwLength = sizeof(st);
GlobalMemoryStatusEx(&st);
hb_retnll( ( LONGLONG ) st.ullAvailPhys);
}
#pragma ENDDUMP
// eof
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 388 |
Nodes: | 16 (2 / 14) |
Uptime: | 11:07:07 |
Calls: | 8,221 |
Files: | 13,122 |
Messages: | 5,872,710 |