Detecting CPU and gfx card !
Hi,
I want to detect a computer''s gfx card and the CPU model & speed. To make it short, something like this should be my final output string:
"Pentium 3 500, nVidia TNT2 Ultra"
The Win32 API functions doesn''t even provide enough infos to clearly identify the CPU model. And EnumDisplaySettings doesn''t set the driver name field of the DEVMODE structure.
Could your provide me with any code or point me in the right direction ???
Thanx
Tim
--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
well, there''s a win32 function to detect the proccessor type. I don''t remember this function. to detect the cpu speed, you can use this code that I got from a similar post:
as for the type of graphics card and vender, if you''re using OpengL you can just use glGetString(GL_RENDERER), and glGetString(GL_VENDOR) to detect the renderer and the vendor.
JoeMont001@aol.com www.polarisoft.n3.net
DWORD GetCpuSpeed(){ int timeStart = 0; int timeStop = 0; unsigned long StartTicks = 0; unsigned long EndTicks = 0; unsigned long TotalTicks = 0; unsigned long cpuSpeed = 0; timeStart = timeGetTime(); // Get tick edge for( ; ; ) { timeStop = timeGetTime(); if ( (timeStop-timeStart) > 1 ) // rollover past 1 { __asm{ xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx _emit 0x0f // CPUID _emit 0xa2 _emit 0x0f // RTDSC _emit 0x31 mov [StartTicks], eax // Tick counter starts here } break; } } timeStart = timeStop; for( ; ; ) { timeStop = timeGetTime(); if ( (timeStop-timeStart) > 1000 ) // one second { __asm{ xor eax, eax xor ebx, ebx xor ecx, ecx xor edx, edx _emit 0x0f _emit 0xa2 _emit 0x0f _emit 0x31 mov [EndTicks], eax } break; } } TotalTicks = EndTicks-StartTicks; // total cpuSpeed = TotalTicks/1000000; // speed return((DWORD)cpuSpeed);}
as for the type of graphics card and vender, if you''re using OpengL you can just use glGetString(GL_RENDERER), and glGetString(GL_VENDOR) to detect the renderer and the vendor.
JoeMont001@aol.com www.polarisoft.n3.net
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
For the name, but not the speed or capabilities of an item, you might (not actually sure if this works ) want to look in (assuming this program will run in windows only) the registry values around HKEY_LOCAL_MACHINE\hardware\
I found alot of info, but didn''t find my own video card in there, so, not sure if this is all that great of an idea
I found alot of info, but didn''t find my own video card in there, so, not sure if this is all that great of an idea
SYSTEM_INFO siSysInfo;GetSystemInfo(&siSysInfo); char string[200];sprintf(string,"Number of Processors: %u\nProcessor Type: %u",siSysInfo.dwNumberOfProcessors,siSysInfo.dwProcessorType);
This should give you some information, though I haven''t tried it, I adapted it from something I found in my Borland references.
You can get info about your video card with lpDDraw->GetDeviceIdentifier()
The road to success is always under construction
Edited by - Tornado on September 10, 2000 2:18:53 PM
The road to success is always under construction
Edited by - Tornado on September 10, 2000 2:18:53 PM
Goblineye EntertainmentThe road to success is always under construction
Hi !
Thanks all. I can now obtain the Mhz value, but my main problem is to get the gfx card. I don''t want to use this in an OpenGL or D3D app, so does anyone know a way without using a 3D API ?
The GetSystemInfo function only returns informations such as X86 class, so I can''t tell the difference between Athlon/P2/P3/Celeron etc.
Thanx
Tim
--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Thanks all. I can now obtain the Mhz value, but my main problem is to get the gfx card. I don''t want to use this in an OpenGL or D3D app, so does anyone know a way without using a 3D API ?
The GetSystemInfo function only returns informations such as X86 class, so I can''t tell the difference between Athlon/P2/P3/Celeron etc.
Thanx
Tim
--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
Null an Void:
The problem is (as you aready realized ;-) ) that those informations are hard to find / parse in the registry. And I heard that NT has a different registry when it comes to hw config issues. And I can''t test my code much on NT systems, but it should work on those. My main problem remains those gfx card detection...
Tim
--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
The problem is (as you aready realized ;-) ) that those informations are hard to find / parse in the registry. And I heard that NT has a different registry when it comes to hw config issues. And I can''t test my code much on NT systems, but it should work on those. My main problem remains those gfx card detection...
Tim
--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement