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 裝置線上狀態變更事件,以及在使用者登入或登出裝置時新增或移除處理常式的程式碼範例。
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;
這個頁面有幫助嗎?