다음을 통해 공유


XStoreQueryProductForPackageAsync

지정된 패키지에 대한 Microsoft Store 제품 정보를 검색합니다.

구문

HRESULT XStoreQueryProductForPackageAsync(  
         const XStoreContextHandle storeContextHandle,  
         XStoreProductKind productKinds,  
         const char* packageIdentifier,  
         XAsyncBlock* async  
)  

매개 변수

storeContextHandle _In_
형식: XStoreContextHandle

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

productKinds _In_
형식: XStoreProductKind

찾을 제품의 유형입니다.

packageIdentifier _In_z_
형식: char*

Microsoft Store 패키지를 고유하게 식별하는 문자열입니다. 패키지 식별자에 대한 자세한 내용은 DLC(다운로드 가능한 콘텐츠 관리 및 라이선스)를참조하세요.

async _Inout_
형식: XAsyncBlock*

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

반환 값

형식: HRESULT

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

비고

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

다음 코드 조각은 패키지에 대한 제품 정보 검색 예를 보여줍니다.

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

    HRESULT hr = XStoreQueryProductForPackageResult(
        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 QueryProductForPackage(XStoreContextHandle storeContextHandle, const char* packageIdentifier)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;
    asyncBlock->callback = QueryProductForPackageCallback;

    XStoreProductKind allProductKinds =
        XStoreProductKind::Consumable |
        XStoreProductKind::Durable |
        XStoreProductKind::Game |
        XStoreProductKind::Pass |
        XStoreProductKind::UnmanagedConsumable;

    HRESULT hr = XStoreQueryProductForPackageAsync(
        storeContextHandle,
        allProductKinds,
        packageIdentifier,
        asyncBlock.get());

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


요구 사항

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

라이브러리: xgameruntime.lib

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

참고 항목

XStore
XStoreQueryProductForPackageResult
XStoreQueryAssociatedProductsAsync
XStoreQueryEntitledProductsAsync
XStoreQueryProductsAsync
XStoreQueryProductForCurrentGameAsync
XStoreQueryProductForPackageAsync