I don't use Visual Studio and/or C++ so I would like to do it without them. I found this article
c++ - How to determine CPU and memory consumption from inside a process? - Stack Overflow
I tried some lines of code but no one works for me.
error: initializer element is not constant:Code:#include "windows.h" typedef struct _MEMORYSTATUSEX { DWORD dwLength; DWORD dwMemoryLoad; DWORDLONG ullTotalPhys; DWORDLONG ullAvailPhys; DWORDLONG ullTotalPageFile; DWORDLONG ullAvailPageFile; DWORDLONG ullTotalVirtual; DWORDLONG ullAvailVirtual; DWORDLONG ullAvailExtendedVirtual; } MEMORYSTATUSEX, *LPMEMORYSTATUSEX; WINBASEAPI BOOL WINAPI GlobalMemoryStatusEx( IN OUT LPMEMORYSTATUSEX lpBuffer ); MEMORYSTATUSEX memInfo; DWORDLONG totalPhysMem = memInfo.ullTotalPhys; memInfo.dwLength = sizeof MEMORYSTATUSEX; GlobalMemoryStatusEx(&memInfo); DWORDLONG totalVirtualMem = memInfo.ullTotalPageFile; DWORDLONG virtualMemUsed = memInfo.ullTotalPageFile - memInfo.ullAvailPageFile;
DWORDLONG totalPhysMem = memInfo.ullTotalPhys;
error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
memInfo.dwLength = sizeof MEMORYSTATUSEX;
These was just my first tries to work with da MEMORYSTATUSEX.
I would like to find out if there is free memory at least ... (some value) and similar.