Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
订阅 XBOX Live 设备 Presence 更改事件以及在用户登录或注销设备时添加或删除处理程序的示例代码。
uint64_t xuid{ 123 }; HRESULT hr = XblPresenceSubscribeToDevicePresenceChange( xboxLiveContext, xuid, &state.devicePresenceChangeSubscription );
HRESULT hr = XblPresenceUnsubscribeFromDevicePresenceChange( xboxLiveContext, state.devicePresenceChangeSubscription ); state.devicePresenceChangeSubscription = nullptr;
state.devicePresenceChangedHandlerToken = XblPresenceAddDevicePresenceChangedHandler( xboxLiveContext, [](void* context, uint64_t xuid, XblPresenceDeviceType deviceType, bool isUserLoggedOnDevice) { UNREFERENCED_PARAMETER(context); LogToFile("Device presence change notification received:"); LogToFile("Xuid = %u, deviceType = %u, isUserLoggedOnDevice = %u", xuid, deviceType, isUserLoggedOnDevice); }, nullptr );
HRESULT hr = XblPresenceRemoveDevicePresenceChangedHandler( xboxLiveContext, state.devicePresenceChangedHandlerToken ); state.devicePresenceChangedHandlerToken = 0;
此页面对您有帮助吗?