> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XStoreQueryProductForCurrentGameAsync

> XStoreQueryProductForCurrentGameAsync

# XStoreQueryProductForCurrentGameAsync

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

## 구문

```cpp theme={null}
HRESULT XStoreQueryProductForCurrentGameAsync(  
         const XStoreContextHandle storeContextHandle,  
         XAsyncBlock* async  
)  
```

### 매개 변수

*storeContextHandle*   \_In\_\
형식: XStoreContextHandle

[XStoreCreateContext](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorecreatecontext.md)에서 반환된 사용자의 스토어 컨텍스트 핸들입니다.

*async*   \_Inout\_\
형식: [XAsyncBlock\*](https://docs.xbox.com/ko/reference/system/xasync/structs/xasyncblock.md)

수행 중인 비동기 작업을 정의하는 [XAsyncBlock](https://docs.xbox.com/ko/reference/system/xasync/structs/xasyncblock.md)입니다. [XAsyncBlock](https://docs.xbox.com/ko/reference/system/xasync/structs/xasyncblock.md)을 사용하여 호출 상태를 폴링하고 호출 결과를 검색할 수 있습니다. 자세한 내용은 [XAsyncBlock](https://docs.xbox.com/ko/reference/system/xasync/structs/xasyncblock.md)을 참조하세요.

### 반환 값

형식: HRESULT

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

## 설명

이 함수의 실행 결과와 스토어 제품 정보를 검색하려면 이 함수를 호출한 후 [XStoreQueryProductForCurrentGameResult](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductforcurrentgameresult.md)를 호출합니다.

다음 코드 조각은 현재 실행 중인 게임의 스토어 제품 정보를 검색하는 예를 보여줍니다.

```cpp theme={null}
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 콘솔

## 개념 설명서

* [게임에서 인게임 구매 구현](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/pc-e2e-guide/e2e-services/e2e-in-game-purchases)
* [기본 스토어 작업](https://docs.xbox.com/ko/publishing/xstore-commerce/xstore-basic-operations.md)

## 참고 항목

[XStore](https://docs.xbox.com/ko/reference/system/xstore/xstore_members.md)\
[XStoreQueryProductForCurrentGameResult](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductforcurrentgameresult.md)\
[XStoreQueryAssociatedProductsAsync](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryassociatedproductsasync.md)\
[XStoreQueryEntitledProductsAsync](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryentitledproductsasync.md)\
[XStoreQueryProductsAsync](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductsasync.md)\
[XStoreQueryProductForCurrentGameAsync](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductforcurrentgameasync.md)\
[XStoreQueryProductForPackageAsync](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductforpackageasync.md)


## Related topics

- [XStoreQueryProductForCurrentGameResult](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductforcurrentgameresult.md)
- [XStoreQueryProductForPackageAsync](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductforpackageasync.md)
- [XStoreQueryProductsAsync](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductsasync.md)
- [XStoreQueryProductForPackageResult](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryproductforpackageresult.md)
- [XStoreQueryAssociatedProductsForStoreIdResult](https://docs.xbox.com/ko/reference/system/xstore/functions/xstorequeryassociatedproductsforstoreidresult.md)
