Cat RAM am pe computer?

Acest forum este dedicat intrebarilor de Windows API, folosing C/C++
Post Reply
User avatar
Zeros
Membru
Membru
Posts: 54
Joined: 12 Jul 2007, 12:34
Location: Waslooy

Cat RAM am pe computer?

Post by Zeros » 12 Jul 2007, 13:03

E vre-un API cu care pot afla?



User avatar
Marius Bancila
Fondator
Fondator
Posts: 2344
Joined: 11 Jul 2007, 11:45
Judet: Timiş
Location: Timisoara
Contact:

Re: Cat RAM am pe computer?

Post by Marius Bancila » 12 Jul 2007, 13:21

Pentru asta ai nevoie de GlobalMemoryStatus.

Alte functii pentru managementul memorie gasesti aici: http://msdn2.microsoft.com/en-us/library/aa366781.aspx.

Aici ai functiile care iti dau informatii despre sistem: http://msdn2.microsoft.com/en-us/library/ms724953.aspx.
Marius Bancila
Fondator Codexpert, Microsoft MVP VC++
Site personal | Blog

User avatar
Zeros
Membru
Membru
Posts: 54
Joined: 12 Jul 2007, 12:34
Location: Waslooy

Re: Cat RAM am pe computer?

Post by Zeros » 15 Jul 2007, 01:26

Fain, merge.
Dar cum pot afla valoarea "PF USAGE" care apare in taskmanager?
Pare ca GlobalMemoryStatus nu-i buna. :cry:
Am pus si poza. :mrgreen:
Attachments
Clipboard01.gif
Clipboard01.gif (1.67 KiB) Viewed 5900 times
V-am pupat! :-)

User avatar
Ovidiu Cucu
Fondator
Fondator
Posts: 3778
Joined: 11 Jul 2007, 16:10
Judet: Iaşi
Location: Iasi
Contact:

Re: Cat RAM am pe computer?

Post by Ovidiu Cucu » 15 Jul 2007, 01:56

Cum nu-i buna? Da valori complet aiurea sau nu vrea sa-ti dea direct in MB?.. :)

Well, scrie o functie de genul:

Code: Select all

DWORD GetPFUsage()
{
   const DWORD nFactor = 0x100000; // MB

   MEMORYSTATUS ms = {0};
   ms.dwLength = sizeof(MEMORYSTATUS);
   ::GlobalMemoryStatus(&ms);
   return (ms.dwTotalPageFile - ms.dwAvailPageFile) / nFactor; // ---> PF Usage (MB).
}
La mine merge. :lol:

User avatar
Zeros
Membru
Membru
Posts: 54
Joined: 12 Jul 2007, 12:34
Location: Waslooy

Re: Cat RAM am pe computer?

Post by Zeros » 15 Jul 2007, 02:06

Oh, sorry! Stupid me! :oops:
V-am pupat! :-)

dacul
Junior
Junior
Posts: 37
Joined: 27 Jul 2007, 12:02

Re: Cat RAM am pe computer?

Post by dacul » 27 Aug 2007, 13:02

cred ca ar merge si un wmi aici

User avatar
Hannibal
Membru
Membru
Posts: 104
Joined: 30 Jul 2007, 15:18
Location: Bucuresti
Contact:

Re: Cat RAM am pe computer?

Post by Hannibal » 27 Aug 2007, 13:43

structura Win32_OperatingSystem ( http://msdn2.microsoft.com/en-us/library/aa394239.aspx )
am lasat doar parametrii legati de memorie.

Code: Select all

class Win32_OperatingSystem : CIM_OperatingSystem
{
  ....
  uint64 FreePhysicalMemory;
  uint64 FreeSpaceInPagingFiles;
  uint64 FreeVirtualMemory;[/b]
  ... 
  uint64 TotalSwapSpaceSize;
  uint64 TotalVirtualMemorySize;
  uint64 TotalVisibleMemorySize;[/b]
};
For the End of the World spell, press control, alt, delete.

Post Reply