The Windows Experience Index measures the capability of your computer’s hardware and software configuration and expresses this measurement as a number called a base score. A higher base score generally means that your computer will perform better and faster than a computer with a lower base score. How shall we calculate this base score?
Windows Vista provides WinSAT (Windows System Assessment Tool) APIs to assesses the performance characteristics and capabilities of a computer. IProvideWinSATResultsInfo interface gives information about an assessment.
#include "Winsatcominterfacei.h" void CsliderctrlDlg::OnBnClickedButton2() { HRESULT hr = S_OK; IQueryRecentWinSATAssessment* pAssessment; IProvideWinSATResultsInfo* pResults = NULL; float baseScore = 0.0; WINSAT_ASSESSMENT_STATE state; CoInitialize(NULL); hr = CoCreateInstance(__uuidof(CQueryWinSAT), NULL,CLSCTX_INPROC_SERVER, __uuidof(IQueryRecentWinSATAssessment), (void**)&pAssessment); if (SUCCEEDED(hr)) { hr = pAssessment->get_Info(&pResults); if (SUCCEEDED(hr)) { hr = pResults->get_AssessmentState(&state); if (SUCCEEDED(hr)) { switch(state) { case WINSAT_ASSESSMENT_STATE_UNKNOWN: wprintf(L"The state of the assessment is unknown.\n"); break; case WINSAT_ASSESSMENT_STATE_VALID: case WINSAT_ASSESSMENT_STATE_INCOHERENT_WITH_HARDWARE: hr = pResults->get_SystemRating(&baseScore); if (SUCCEEDED(hr)) { wprintf(L"The base score for the computer is %.1f\n", baseScore); if (WINSAT_ASSESSMENT_STATE_INCOHERENT_WITH_HARDWARE == state) { wprintf(L"Note that the hardware configuration of the computer has changed\n" L"since the assessment was run; the score reflects the prior configuration."); } } else { // Handle error } break; case WINSAT_ASSESSMENT_STATE_NOT_AVAILABLE: wprintf(L"A formal assessment has not run on the computer.\n"); break; case WINSAT_ASSESSMENT_STATE_INVALID: wprintf(L"The assessment data is not valid.\n"); break; default: wprintf(L"The assessment state value is not valid.\n"); } } else { // Handle error } pResults->Release(); pResults = NULL; } else { // Handle error } pAssessment->Release(); pAssessment = NULL; } else { // Handle error } }
Courtesy : MSDN
Don’t forget, its applicable only to Windows Vista and higher versions.
Fantastic site. A lot of useful info here. I’m sending it to a few buddies ans also sharing in delicious. And obviously, thank you for your sweat!
Thank you