Windows Dev Center

IProvideWinSATResultsInfo::GetAssessmentInfo method

[IProvideWinSATResultsInfo::GetAssessmentInfo may be altered or unavailable for releases after Windows 8.1.]

Retrieves summary information for a subcomponent of the assessment.

Syntax


HRESULT GetAssessmentInfo(
  [in]  WINSAT_ASSESSMENT_TYPE       assessment,
  [out] IProvideWinSATAssessmentInfo **ppinfo
);

Parameters

assessment [in]

A subcomponent of the assessment whose summary information you want to retrieve. For possible values, see the WINSAT_ASSESSMENT_TYPE enumeration.

ppinfo [out]

An IProvideWinSATAssessmentInfo interface that you use to get the score for the subcomponent.

Return value

Returns S_OK if successful.

Examples

The following example shows how to get the scores for each subcomponent of the assessment.


#include <windows.h>
#include <stdio.h>
#include <winsatcominterfacei.h>

#pragma comment(lib, "ole32.lib")
#pragma comment(lib, "oleaut32.lib")

HRESULT PrintComponentScore(IProvideWinSATAssessmentInfo* pSubcomponent);

void main(void)
{
    HRESULT hr = S_OK;
    IQueryRecentWinSATAssessment* pAssessment;
    IProvideWinSATResultsInfo* pResults = NULL;
    IProvideWinSATAssessmentInfo* pSubcomponent = NULL;

    hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

    // Get an instance to the most recent formal assessmenet.
    hr = CoCreateInstance(__uuidof(CQueryWinSAT),
        NULL,
        CLSCTX_INPROC_SERVER,
        __uuidof(IQueryRecentWinSATAssessment),
        (void**)&pAssessment);

    if (FAILED(hr))
    {
        wprintf(L"Failed to create an instance of IQueryRecentWinSATAssessment. Failed with 0x%x.\n", hr);
        goto cleanup;
    }

    hr = pAssessment->get_Info(&pResults);
    if (FAILED(hr))
    {
        wprintf(L"pAssessment->get_Info failed with 0x%x.\n", hr);
        goto cleanup;
    }


    hr = pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_CPU, &pSubcomponent);
    if (FAILED(hr))
    {
        wprintf(L"pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_CPU) failed with 0x%x.\n", hr);
        goto cleanup;
    }

    if (FAILED(PrintComponentScore(pSubcomponent)))
        goto cleanup;

    pSubcomponent->Release();
    pSubcomponent = NULL;


    hr = pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_MEMORY, &pSubcomponent);
    if (FAILED(hr))
    {
        wprintf(L"pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_MEMORY) failed with 0x%x.\n", hr);
        goto cleanup;
    }

    if (FAILED(PrintComponentScore(pSubcomponent)))
        goto cleanup;

    pSubcomponent->Release();
    pSubcomponent = NULL;

    hr = pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_DISK, &pSubcomponent);
    if (FAILED(hr))
    {
        wprintf(L"pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_DISK) failed with 0x%x.\n", hr);
        goto cleanup;
    }

    if (FAILED(PrintComponentScore(pSubcomponent)))
        goto cleanup;

    pSubcomponent->Release();
    pSubcomponent = NULL;

    hr = pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_D3D, &pSubcomponent);
    if (FAILED(hr))
    {
        wprintf(L"pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_D3D) failed with 0x%x.\n", hr);
        goto cleanup;
    }

    if (FAILED(PrintComponentScore(pSubcomponent)))
        goto cleanup;

    pSubcomponent->Release();
    pSubcomponent = NULL;

    hr = pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_GRAPHICS, &pSubcomponent);
    if (FAILED(hr))
    {
        wprintf(L"pResults->GetAssessmentInfo(WINSAT_ASSESSMENT_GRAPHICS) failed with 0x%x.\n", hr);
        goto cleanup;
    }

    if (FAILED(PrintComponentScore(pSubcomponent)))
        goto cleanup;

    pSubcomponent->Release();
    pSubcomponent = NULL;

cleanup:

    if (pAssessment)
        pAssessment->Release();

    if (pResults)
        pResults->Release();

    if (pSubcomponent)
        pSubcomponent->Release();

    CoUninitialize();
}


HRESULT PrintComponentScore(IProvideWinSATAssessmentInfo* pSubcomponent)
{
    HRESULT hr = S_OK;
    BSTR bstrTitle = NULL;
    float score = 0.0;

    hr = pSubcomponent->get_Score(&score);
    hr = pSubcomponent->get_Title(&bstrTitle);
    if (FAILED(hr))
    {
        wprintf(L"pSubcomponent->get_Title failed with 0x%x.\n", hr);
        goto cleanup;
    }

    wprintf(L"%s %.1f\n", bstrTitle, score);

cleanup:

    if (bstrTitle)
        SysFreeString(bstrTitle);

    return hr;
}


Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

None supported

End of client support

Windows 8.1

End of server support

None supported

Header

Winsatcominterfacei.h

DLL

Winsatapi.dll

See also

IProvideWinSATResultsInfo

 

 

Community Additions

ADD
Show:
© 2015 Microsoft