fernandousaaa
fernandousaaa

Reputation: 81

Get CPU, RAM and GPU information - UWP App

Is possible get the information of the CPU, GPU and RAM of a computer, in a UWP app? E show this information in a textblock.

I want to know the processor model (for example: Intel Core i7 xxxx), and total RAM

Upvotes: 4

Views: 3687

Answers (3)

panpernicek
panpernicek

Reputation: 676

You can get at least some device information which includes CPU model using following code. It will include lot of devices and one of them is CPU.

string result = "Devices\r\n";

DeviceInformationCollection dic = await DeviceInformation.FindAllAsync(DeviceClass.All);

foreach (var deviceinfo in dic)
{
    result += "\r\nID: " + deviceinfo.Id + ", Name: " + deviceinfo.Name + ", Kind: " + deviceinfo.Kind + ", EnclosureLocation: " + deviceinfo.EnclosureLocation + ", IsEnabled: " + deviceinfo.IsEnabled;
}

Upvotes: 0

Sunteen Wu
Sunteen Wu

Reputation: 10627

I want to know the processor model (for example: Intel Core i7 xxxx), and total RAM

If in this case, UWP app cannot meet your demands. In UWP you can not get the system CPU , GPU and RAM information since it is sandbox.

For RAM, UWP can only access to information on current app's memory usage by using the MemoryManager class as the comment mentioned.

For GPU information, currently there is no API can access GPU directly in UWP app. You may need to create a UWP app with DirectX and access the information by DirectX. You may find some relative samples here.

Since Win32 could do this, as a suggestion, you could try to use Desktop Bridge to convert the Win32 desktop app to UWP. For how to get these information in Win32 you could reference this.

Upvotes: 3

Adam Dernis
Adam Dernis

Reputation: 530

You're going to need to use [DllImport("kernal32")] for the full info. This question has the implementation you need. This question answers how to get the RAM usage and CPU usage much easier.

Upvotes: 0

Related Questions