如何使用 Skype4COMLib 在 VB.NET 中自动接受 Skype 好友请求?

How to auto accept Skype friend requests in VB.NET using Skype4COMLib?

大家好,我正在尝试使用 VB.NET 和 Skype4COMLib 在我的 Skype 上自动接受好友请求,但我收到此错误:

Private Sub oskype_userauthorizationrequestreceived(pUser As SKYPE4COMLib.User)' cannot handle event 'Public Event UserAuthorizationRequestReceived(sender As Object, e As AxSKYPE4COMLib._ISkypeEvents_UserAuthorizationRequestReceivedEvent)' because they do not have a compatible signature.

代码:

 Private Sub oskype_userauthorizationrequestreceived(pUser As User) Handles oSkype.UserAuthorizationRequestReceive 
    If MaterialCheckBox7.Checked = True And pUser.IsAuthorized = False Then
        pUser.IsAuthorized = True
    End If
End Sub

我无法解决它,我希望它在我单击我的复选框时接受好友请求并在我取消选中复选框时禁用自动接受请求。

感谢任何帮助,谢谢。

抱歉这么晚回复,但错误信息其实很清楚。

您的活动订阅当前如下所示:

Private Sub oskype_userauthorizationrequestreceived(pUser As SKYPE4COMLib.User) Handles oSkype.UserAuthorizationRequestReceive

但是 Skype4Com 库的事件是这样声明的:

Public Event UserAuthorizationRequestReceived(sender As Object, e As AxSKYPE4COMLib._ISkypeEvents_UserAuthorizationRequestReceivedEvent)

如您所见,您缺少一个参数,而第二个参数的类型错误。

修复只是更改参数以匹配事件:

Private Sub oskype_userauthorizationrequestreceived(sender As Object, e As AxSKYPE4COMLib._ISkypeEvents_UserAuthorizationRequestReceivedEvent) Handles oSkype.UserAuthorizationRequestReceive

我想如果您查看 e 参数的属性,您可以提取特定用户。