How would I get these values into my C++ or C# program?
[img]http://img.loldepot.com/f825a171eca86942b83e.png[/img]
Additional questions by r4nk_.
[quote]CPU usage
Ram usage
Current upload and download speed/network transfer amount
Set a limit on the download speed for all processes
List of all running processes [/quote]
Good question, mind if I add a few related questions?
How do you get:
CPU usage
Ram usage
Current upload and download speed/network transfer amount
Set a limit on the download speed for all processes
List of all running processes
[url]http://www.codeproject.com/KB/dotnet/perfcounter.aspx[/url]
For the usage and so on.
[url]http://msdn.microsoft.com/en-us/library/1f3ys1f9.aspx[/url]
for the list of running processes
Thanks but I couldn't find Kernel paged and unpaged memory in there.
[QUOTE=r4nk_;18417989]
List of all running processes[/QUOTE]
Windows:
[cpp]
#include <Tlhelp32.h>
...
void listProcesses()
{
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PPROCESSENTRY32 proc;
proc.dwSize = sizeof(proc);
Process32First(snapshot, &proc);
do
{
puts(proc.szExeFile);
}
while(Process32Next(snapshot, &proc));
CloseHandle(snapshot);
}
[/cpp]
Read /proc/meminfo
Is it even possible to do it in C++? I was thinking it might be a function in kernel32.dll but I'm not sure.
[QUOTE=r4nk_;18417989]
Ram usage[/QUOTE]
[cpp]MEMORYSTATUSEX memstatus;
memstatus.dwLength = sizeof(memstatus);
GlobalMemoryStatusEx(&memstatus);
//now use memstatus.ullAvailPhys, memstatus.ullTotalPhys, memstatus.dwMemoryLoad (a percentage)
[/cpp]
Just look around the Windows API a bit and you'll find the answer to anything about Windows :v:
In .NET, you can use the ManagementObjectManager (Or something like that) to query WMI about a trillion different things, including CPU display string, available memory, swap, etc.
[QUOTE=Diaklu;18421148]Is it even possible to do it in C++? I was thinking it might be a function in kernel32.dll but I'm not sure.[/QUOTE]
In native C++? No. You're going to have to use WinAPI
Sorry, you need to Log In to post a reply to this thread.