扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:shannon 来源:天极网 2007年10月14日
关键字: Visual Basic 调用 API
Private WithEvents oMSN As MessengerAPI.Messenger |
Public Sub SignIn(ByVal bAuto As Boolean, Optional ByVal sSignInName As String, Optional ByVal sPassword As String) On Error GoTo ErrorHandle If bAuto = True Then oMSN.AutoSignin Else ManualSignIn: oMSN.SignIn 0, sSignInName, sPassword End If Exit Sub ErrorHandle: Dim MConstants As MSGRConstants MConstants = err.Number If MConstants = MSGR_E_FAIL Then GoTo ManualSignIn ElseIf MConstants = MSGR_E_ALREADY_LOGGED_ON Then ’已经登陆 End If End Sub |
Dim oContacts As IMessengerContacts Dim oContact As IMessengerContact Dim iCount As Integer Dim i As Long Set oContacts = oMSN.MyContacts iCount = oContacts.Count For i = 0 To iCount - 1 Set oContact = MsgrContacts.Item List1.AddItem MsgrContact.FriendlyName & vbTab & "(" & getStatusDesc(MsgrContact.Status) & ")" Next |
Private Function getStatusDesc(eStatus As MISTATUS) As String Select Case eStatus Case MISTATUS_AWAY getStatusDesc = "走开了" Case MISTATUS_BE_RIGHT_BACK getStatusDesc = "马上回来" Case MISTATUS_BUSY getStatusDesc = "在忙碌" Case MISTATUS_IDLE getStatusDesc = "在发呆" Case MISTATUS_INVISIBLE getStatusDesc = "隐身" Case MISTATUS_LOCAL_CONNECTING_TO_SERVER getStatusDesc = "正在链接服务器" Case MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER getStatusDesc = "从服务器断开" Case MISTATUS_LOCAL_FINDING_SERVER getStatusDesc = "正在搜索服务器" Case MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER getStatusDesc = "正在和服务器同步" Case MISTATUS_OFFLINE getStatusDesc = "离线" Case MISTATUS_ON_THE_PHONE getStatusDesc = "在接电话" Case MISTATUS_ONLINE getStatusDesc = "在线" Case MISTATUS_OUT_TO_LUNCH getStatusDesc = "外出就餐" Case MISTATUS_UNKNOWN getStatusDesc = "未知" End Select End Function |
Dim oGroups As IMessengerGroups Dim oGroup As IMessengerGroup Set oGroups = oMSN.MyGroups For Each oGroup In oGroups List1.AddItem oGroup.Name Next |
Dim oGroups As IMessengerGroups Dim oGroup As IMessengerGroup Dim oContacts As IMessengerContacts Dim oContact As IMessengerContact Set oGroups = oMSN.MyGroups For Each oGroup In oGroups Set oContacts = oGroup.Contacts For Each oContact In oContacts List1.AddItem oGroup.Name & " " & oContact.SigninName Next Next |
Dim oServices As IMessengerServices Dim oService As IMessengerService Set oServices = oMSN.Services Set oService = oServices.PrimaryService MsgBox oService.MyFriendlyName & getStatusDesc(oService.MyStatus) & oService.MySigninName & oService.ServiceId & oService.ServiceName |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者