> ## 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.

# IGameInputDevice::GetVendorId

> 取得輸入裝置的廠商識別碼。

取得輸入裝置的廠商識別碼。

## 語法

```cpp theme={null}
uint16_t GetVendorId();
```

### 參數

此方法沒有參數。

### 傳回值

類型：uint16\_t

識別輸入裝置製造商的廠商識別碼；如果裝置未回報廠商識別碼，則為 0。

## 備註

廠商識別碼與 [IGameInputDevice::GetProductId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getproductid.md) 傳回的產品識別碼一起識別特定的裝置型號。對於 USB 和藍牙裝置，這些通常是裝置向作業系統回報的相同廠商和產品識別碼。使用 [IGameInputDevice::GetRevisionNumber](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrevisionnumber.md) 區分同一產品的不同硬體修訂版本。

廠商識別碼在裝置物件的存留期間內不會變更。

下列範例會檢查裝置是否符合特定的廠商和產品識別碼。

```cpp theme={null}
bool IsDeviceModel(
    IGameInputDevice* device,
    uint16_t vendorId,
    uint16_t productId) noexcept
{
    return device->GetVendorId() == vendorId &&
           device->GetProductId() == productId;
}
```

在 GameInput v3 及更早版本中，此資訊可從 [IGameInputDevice::GetDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceinfo.md) 所傳回 [GameInputDeviceInfo](https://docs.xbox.com/zh-TW/reference/input/gameinput/deprecated/structs/gameinputdeviceinfo.md) 結構的 `vendorId` 成員取得。

## 需求

**標頭：** GameInput.h

**程式庫：** gameinput.lib

**支援的平台：** Windows、XBOX One 系列主機和 XBOX Series 主機

## 另請參閱

[GameInput 概觀](https://docs.xbox.com/zh-TW/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputDevice](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/igameinputdevice.md)\
[IGameInputDevice::GetProductId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getproductid.md)\
[IGameInputDevice::GetRevisionNumber](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrevisionnumber.md)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v4** | 已推出。 |


## Related topics

- [IGameInputDevice::GetProductId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getproductid.md)
- [IGameInputDevice::GetRevisionNumber](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getrevisionnumber.md)
- [IGameInputDevice::GetDeviceId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdeviceid.md)
- [IGameInputDevice::GetDeviceRootId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getdevicerootid.md)
- [IGameInputDevice::GetContainerId](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_getcontainerid.md)
