다음을 통해 공유


XStoreQueryProductForCurrentGameAsync

현재 실행 중인 게임, 해당 SKU 및 가용성과 기타 메타 데이터에 대한 Microsoft Store 제품 정보를 제공합니다.

구문

HRESULT XStoreQueryProductForCurrentGameAsync(  
         const XStoreContextHandle storeContextHandle,  
         XAsyncBlock* async  
)  

매개 변수

storeContextHandle _In_
형식: XStoreContextHandle

XStoreCreateContext가 반환하는 사용자의 Microsoft Store 컨텍스트 핸들입니다.

async _Inout_
형식: XAsyncBlock*

수행할 비동기 작업을 정의하는 XAsyncBlock입니다. 호출의 상태를 폴링하고 호출 결과를 검색하기 위해 사용할 수 있는 XAsyncBlock입니다. 자세한 내용은 XAsyncBlock을 참조하세요.

반환 값

형식: HRESULT

HRESULT 성공 또는 오류 코드입니다.

비고

Microsoft Store 제품 정보와 이 함수의 실행 결과를 함께 검색하려면, 이 함수 호출 후 XStoreQueryProductForCurrentGameResult를 호출합니다.

다음 코드 조각은 현재 실행 중인 게임에 대한 Microsoft Store 제품 정보를 검색하는 예를 보여줍니다.

void CALLBACK QueryProductForCurrentGameCallback(XAsyncBlock* asyncBlock)
{
    XStoreProductQueryHandle queryHandle = nullptr;

    HRESULT hr = XStoreQueryProductForCurrentGameResult(
        asyncBlock,
        &queryHandle);

    if (FAILED(hr))
    {
        printf("Failed retrieve the product query handle: 0x%x\r\n", hr);
        XStoreCloseProductsQueryHandle(queryHandle);
        return;
    }

    // Use result of query

     XStoreCloseProductsQueryHandle(queryHandle);
}

void QueryProductForCurrentGame(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;

    asyncBlock->callback = QueryProductForCurrentGameCallback;

    HRESULT hr = XStoreQueryProductForCurrentGameAsync(
        storeContextHandle,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to get product for current game: 0x%x\r\n", hr);
        return;
    }
}

요구 사항

헤더: XStore.h(XGameRuntime.h에 포함됨)

라이브러리: xgameruntime.lib

지원되는 플랫폼: Windows, Xbox One 패밀리 콘솔 및 Xbox Series 콘솔

참고 항목

XStore
XStoreQueryProductForCurrentGameResult
XStoreQueryAssociatedProductsAsync
XStoreQueryEntitledProductsAsync
XStoreQueryProductsAsync
XStoreQueryProductForCurrentGameAsync
XStoreQueryProductForPackageAsync