Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get hardware info such as CPU name, total RAM, etc. with VB6?

Tags:

winapi

vb6

Title pretty much explains it all. I need to get some hardware information such as CPU info, and total RAM with VB6. Ideally, it would return something like this for the CPU:

Intel Core 2 Quad Q8500 2.66 GHz

and for the RAM something simple like an integer for the amount of MB the computer has total.

like image 585
qJake Avatar asked Nov 29 '25 11:11

qJake


1 Answers

in plain C, if interested:

#include <intrin.h>

int cpuInfo[4] = {-1};
char CPUBrandString[0x40];

memset(CPUBrandString, 0, sizeof(CPUBrandString));

__cpuid(cpuInfo, 0x80000002);
memcpy(CPUBrandString, cpuInfo, sizeof(cpuInfo));

__cpuid(cpuInfo, 0x80000003);
memcpy(CPUBrandString + 16, cpuInfo, sizeof(cpuInfo));

__cpuid(cpuInfo, 0x80000004);
memcpy(CPUBrandString + 32, cpuInfo, sizeof(cpuInfo));
like image 113
Thomas Avatar answered Dec 01 '25 11:12

Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!