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

# XblSocialAddSocialRelationshipChangedHandler

> XblSocialAddSocialRelationshipChangedHandler

# XblSocialAddSocialRelationshipChangedHandler

注册事件处理程序，用于在注册用户引发社交关系更改时接收通知。

## 语法

```cpp theme={null}
XblFunctionContext XblSocialAddSocialRelationshipChangedHandler(  
         XblContextHandle xboxLiveContext,  
         XblSocialRelationshipChangedHandler handler,  
         void* handlerContext  
)  
```

### 参数

*xboxLiveContext*   \_In\_\
类型：[XblContextHandle](/reference/live/xsapi-c/types_c/handles/xblcontexthandle)

使用 XblContextCreateHandle 创建的 XBOX Live 上下文句柄。

*handler*   \_In\_\
类型：XblSocialRelationshipChangedHandler

接收通知的回调函数。

*handlerContext*   \_In\_opt\_\
类型：void\*

传回给处理程序的客户端上下文指针。

### 返回值

类型：XblFunctionContext

用于移除处理程序的 XblFunctionContext。

## 备注

仅在用户更改与其他用户的关系时才会触发此处理程序。当其他用户更改与该用户的关系时，不会触发此处理程序。调用 [XblSocialRemoveSocialRelationshipChangedHandler](/reference/live/xsapi-c/social_c/functions/xblsocialremovesocialrelationshipchangedhandler) 以注销事件处理程序。

## 要求

**头文件：** social\_c.h

**库：** Microsoft.Xbox.Services.14x.GDK.C.lib

## 另请参阅

[social\_c](/reference/live/xsapi-c/social_c/social_c_members)


## Related topics

- [XblSocialRemoveSocialRelationshipChangedHandler](/zh-CN/reference/live/xsapi-c/social_c/functions/xblsocialremovesocialrelationshipchangedhandler.md)
- [处理社交关系更改](/zh-CN/services/xbox-services/community/people-system/how-to/live-handling-a-relationship-change.md)
- [XblSocialRelationship](/zh-CN/reference/live/xsapi-c/social_c/structs/xblsocialrelationship.md)
- [XblSocialGetSocialRelationshipsResult](/zh-CN/reference/live/xsapi-c/social_c/functions/xblsocialgetsocialrelationshipsresult.md)
- [XblSocialGetSocialRelationshipsAsync](/zh-CN/reference/live/xsapi-c/social_c/functions/xblsocialgetsocialrelationshipsasync.md)
