TableFlipGod
Bronze Coder
Before I get into this I just wanted to point out if you need any help just make a thread with help and I will be more than happy to help you 

So first off you're going to create a new project. Specially a Windows Forms in c#.
Next Design it how you want. But you have to have a few labels to show the text.
Now the fun bit!!! Copy this code and paste it into your program's start function.
[CODE lang="csharp" title="ReturnCPUInfo"]ManagementObjectSearcher mos =
new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");
foreach (ManagementObject mo in mos.Get())
{
label1.Text = ("CPU: " + mo["Name"].ToString());
}[/CODE]
So now ill explain what this code does. It creates a new management Object Searcher from the root system and selects every Win32_Processor or just the processor name like in controlpanel or in task manager.
Then ill do the same for the GPU. Create a new label and place it where you want it to show (preferably and for best Results the very left under the cpu label).
[CODE lang="csharp" title="ReturnGPUInfo"]ManagementObjectSearcher mos2 =
new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_VideoController");
foreach (ManagementObject mo in mos2.Get())
{
GPUName.Text = ("GPU: " + mo["Name"].ToString());
}[/CODE]
Again this does the exact same thing and it just returns GPU info.
[CODE lang="csharp" title="ReturnRAMInfo"]
ManagementObjectSearcher query1 = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
query1 = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
ManagementObjectCollection queryCollection1 = query1.Get();
queryCollection1 = query1.Get();
foreach (ManagementObject mo in queryCollection1)
{
UInt64 mem = Convert.ToUInt64(mo["totalphysicalmemory"]);
RAMName.Text = ("RAM: " + mem / 1000000000 + "GB");
}[/CODE]
So this one is a bit tricky! What ive done here is it gets the ram as a UInt64 so it can store a pretty big number, but if we were to compile the code without the mem / 1000000000 then what would it do?
Next tutorial I will be talking about how to get storage drives info (amounts and types)

So first off you're going to create a new project. Specially a Windows Forms in c#.
Next Design it how you want. But you have to have a few labels to show the text.
Now the fun bit!!! Copy this code and paste it into your program's start function.
Code:
public Form1()
[CODE lang="csharp" title="ReturnCPUInfo"]ManagementObjectSearcher mos =
new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");
foreach (ManagementObject mo in mos.Get())
{
label1.Text = ("CPU: " + mo["Name"].ToString());
}[/CODE]
So now ill explain what this code does. It creates a new management Object Searcher from the root system and selects every Win32_Processor or just the processor name like in controlpanel or in task manager.
Then ill do the same for the GPU. Create a new label and place it where you want it to show (preferably and for best Results the very left under the cpu label).
[CODE lang="csharp" title="ReturnGPUInfo"]ManagementObjectSearcher mos2 =
new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_VideoController");
foreach (ManagementObject mo in mos2.Get())
{
GPUName.Text = ("GPU: " + mo["Name"].ToString());
}[/CODE]
Again this does the exact same thing and it just returns GPU info.
[CODE lang="csharp" title="ReturnRAMInfo"]
ManagementObjectSearcher query1 = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
query1 = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
ManagementObjectCollection queryCollection1 = query1.Get();
queryCollection1 = query1.Get();
foreach (ManagementObject mo in queryCollection1)
{
UInt64 mem = Convert.ToUInt64(mo["totalphysicalmemory"]);
RAMName.Text = ("RAM: " + mem / 1000000000 + "GB");
}[/CODE]
So this one is a bit tricky! What ive done here is it gets the ram as a UInt64 so it can store a pretty big number, but if we were to compile the code without the mem / 1000000000 then what would it do?
Well if you convert bytes to gigabytes it would be 1000000000 times the amount of bytes
Ex. 1 byte -> 1 gb = 1000000000 bytes
So you divide it to show the amount of RAM in 1-2 numbers depends if you're on a server then 3.
Ex. 1 byte -> 1 gb = 1000000000 bytes
So you divide it to show the amount of RAM in 1-2 numbers depends if you're on a server then 3.
Next tutorial I will be talking about how to get storage drives info (amounts and types)
Last edited: