RawGameController.HardwareProductId Property

Definition

The hardware product ID of the raw game controller.

public:
 property unsigned short HardwareProductId { unsigned short get(); };
uint16_t HardwareProductId();
public ushort HardwareProductId { get; }
var uInt16 = rawGameController.hardwareProductId;
Public ReadOnly Property HardwareProductId As UShort

Property Value

UInt16

unsigned short

uint16_t

The hardware product ID of the raw game controller.

Examples

The following example checks if the given raw game controller's PID and VID (Product ID and Vendor ID, respectively) match the given PID and VID.

#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;
...
void CheckIfMatch(RawGameController rawGameController, uint16_t pid, uint16_t vid)
{
    if ((rawGameController.HardwareProductId() == pid) &&
        (rawGameController.HardwareVendorId() == vid))
    {
        /* This controller is the type that we're checking for, so we can assign a
        specific input mapping. */
    }
}

Remarks

If you have a specific controller that you want to support, you can get this value and RawGameController.HardwareVendorId and check that they match the controller. The position of each input in each array that you get from RawGameController.GetCurrentReading is the same for every controller with the same HardwareProductId and HardwareVendorId, so you don't have to worry about your logic potentially being inconsistent among different controllers of the same type.

Applies to