Well, i we're working on a CPU Controller, which shows all CPU Data. I've managed to get Windows Version, Windows Service Pack, Processor Name, Processor Speed, Processor Identifier(Though Registry Vals). But now i don't have any idea of开发者_StackOverflow how to get the processor Instructions, Caches, Video Card Information (Video Card Name, Available Memory, Total Memory), Southbridge Information (Ethernet Information)
Well, i've been loking on WinAPI but i get it very hard to work. I've looked over google 3 hours but nothing. :/ Any idea? :(
Have you looked at WMI ? This appears to suggest you can get SouthBridge info through WMI.
Gonna expand cppanda's answer a bit:
Concerning video cards, there's sometimes more than one in the system. The best way to get oodles n oodles of information on them is to use DirectX.
If it's meant to be compatible with Vista and up, you can use DXGI, which is cleaner and easier to use in my opinion.
First things first, you'll need to create a DXGI factory...
IDXGIFactory* DXGIFactoryPtr = 0;
HRESULT RetVal = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&DXGIFactoryPtr);
if (FAILED(RetVal)) {/*Error Checking*/;}
then use it to loop through each adapter...
unsigned short I = 0;
IDXGIAdapter* AdapterPtr = 0;
std::vector<IDXGIAdapter*> Adapters;
while (DXGIFactoryPtr->EnumAdapters(I, &AdapterPtr) != DXGI_ERROR_NOT_FOUND)
{
Adapters.push_back(AdapterPtr);
++I;
}
From here, you can see if Direct3D 10 is supported:
if (Adapters[I]->CheckInterfaceSupport(__uuidof(ID3D10Device), 0) == S_OK)
{ /*D3D10 is supported for this device*/; }
Enumerate attached outputs [I.E. Moniters], which could be useful for checking which resolutions are supported and such:
unsigned short J = 0;
IDXGIOutput* OutputPtr = 0;
std::vector<IDXGIOutput*> Outputs;
while (Adapter[I]->EnumOutputs(J, &OutputPtr) != DXGI_ERROR_NOT_FOUND)
{
Outputs.push_back(OutputPtr);
++J;
}
and get a description:
DXGI_ADAPTER_DESC AdapterDescription;
Adapter[I]->GetDesc(&AdapterDescription);
AdapterDescription has the fields Description
, VenderId
, DeviceId
, SubSysId
, Revision
, DedicatedVideoMemory
, DedicatedSystemMemory
, SharedSystemMemory
, and AdapterLuid
.
AdapterLuid
is a system specific unique identifier for the card, but all the others should be very obvious given the names.
Beyond that, it becomes vendor specific I think.
For DirectX 9, which is available for Windows 2000 up, it's a bit different. First, you have to create the core Direct3D9 object:
IDirect3D9* D3D9 = Direct3DCreate9(D3D_SDK_VERSION);
if (D3D9 == 0)
{ /* Error checking*/; }
Then get the adapter count:
unsigned short AdapterCount = (unsigned short)D3D9->GetAdapterCount();
Then loop through them, getting their identifiers:
D3DADAPTER_IDENTIFIER9* Identifiers = new D3DADAPTER_IDENTIFIER9[AdapterCount];
HRESULT RetVal = 0;
for (unsigned short I = 0; I < AdapterCount; ++I)
{
RetVal = D3D9->GetAdapterIdentifier(I, 0, &Identifiers[I]);
if (FAILED(RetVal))
{ /* Error checking*/; }
}
Again, most of the fields should be self explanitory. WHQLLevel is information on if and when Microsoft tested that driver's compatability with Windows, and for the most part can be safely ignored. Using close to the same method above, you can also acquire a device's capabilities using GetDeviceCaps, which would give you more information.
As cppanda said, you can use IDirect3DDevice9::GetAvailableTextureMem(), but that requires you to create the device before querying it. Anything the above two don't indicate require creating the device before retrieving it.
Hope that helps~
[Side note, a lot of this was pulled out of the DirectX SDK so code's theirs, not mine.]
Take a look at:
MEMORYSTATUSEX status;
GlobalMemoryStatusEx(&status);
For RAM and Virtual RAM
For video memory vista:
CreateDXGIFactory API via GetProcAddress()
Below vista, d3d9 API
GetAvailableTextureMemory()
Well, the CPUID instruction gives a bit of info. Not all that you need, but it's a start.
精彩评论