Visual Basic 2005 飞信SDK开发短信收发程序
打开 Visual Basic 2005 新建一个项目,引用FetionSDK.dll
Dim fetion As New NullStudio.Fetion_SDK.FetionSDK
登陆
'登陆
Private Sub Btn_Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Login.Click
fetion.AccountManager.FillUserIdAndPassword(Me.Txt_User.Text.ToString, Me.Txt_Password.Text.ToString, False)
Me.Label_LoginPrompt.Text = "正在登陆……"
System.Threading.Thread.Sleep(500)
Dim i As Short
i = fetion.AccountManager.Login()
System.Threading.Thread.Sleep(500)
If i = -1 Then
Me.Label_LoginPrompt.Text = "已经登陆成功"
End If
Btn_Login.Enabled = False
End Sub
Private Sub Btn_Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Login.Click
fetion.AccountManager.FillUserIdAndPassword(Me.Txt_User.Text.ToString, Me.Txt_Password.Text.ToString, False)
Me.Label_LoginPrompt.Text = "正在登陆……"
System.Threading.Thread.Sleep(500)
Dim i As Short
i = fetion.AccountManager.Login()
System.Threading.Thread.Sleep(500)
If i = -1 Then
Me.Label_LoginPrompt.Text = "已经登陆成功"
End If
Btn_Login.Enabled = False
End Sub
发送信息
'发送信息
Private Sub Btn_SendIM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_SendIM.Click
Dim i As Short
'i为0 发送失败 为1 发送成功
'飞信可以给自己发送短信,不能给自己发送飞信
If Me.RadioButton_IM.Checked = True Then
i = fetion.ContactControl.SendIM.SendIM(Me.Txt_SendID.Text.ToString, Me.Txt_SendContent.Text.ToString)
Else
i = fetion.ContactControl.SendSMS.SendSMS(Me.Txt_SendID.Text.ToString, Me.Txt_SendContent.Text.ToString)
End If
Me.Btn_SendIM.Enabled = False
System.Threading.Thread.Sleep(1000)
Me.Btn_SendIM.Enabled = True
End Sub
Private Sub Btn_SendIM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_SendIM.Click
Dim i As Short
'i为0 发送失败 为1 发送成功
'飞信可以给自己发送短信,不能给自己发送飞信
If Me.RadioButton_IM.Checked = True Then
i = fetion.ContactControl.SendIM.SendIM(Me.Txt_SendID.Text.ToString, Me.Txt_SendContent.Text.ToString)
Else
i = fetion.ContactControl.SendSMS.SendSMS(Me.Txt_SendID.Text.ToString, Me.Txt_SendContent.Text.ToString)
End If
Me.Btn_SendIM.Enabled = False
System.Threading.Thread.Sleep(1000)
Me.Btn_SendIM.Enabled = True
End Sub
读取好友列表
'读取好友列表
Private Sub Button_ReadFriend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_ReadFriend.Click
Dim lst
lst = fetion.ContactControl.getAllContactList '我不知道该怎么定义这个类型
System.Threading.Thread.Sleep(1000)
Dim i As Short
For i = 0 To lst.Count - 1
Me.Grid_FriendList.Rows.Add()
Me.Grid_FriendList.Rows(i).Cells(0).Value = lst(i).DisplayName '屏显名称
Me.Grid_FriendList.Rows(i).Cells(1).Value = lst(i).Uri.Id '好友ID
Me.Grid_FriendList.Rows(i).Cells(2).Value = lst(i).PersonalInfo.MobileNo '手机号码
'用户状态
Next
End Sub
Private Sub Button_ReadFriend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_ReadFriend.Click
Dim lst
lst = fetion.ContactControl.getAllContactList '我不知道该怎么定义这个类型
System.Threading.Thread.Sleep(1000)
Dim i As Short
For i = 0 To lst.Count - 1
Me.Grid_FriendList.Rows.Add()
Me.Grid_FriendList.Rows(i).Cells(0).Value = lst(i).DisplayName '屏显名称
Me.Grid_FriendList.Rows(i).Cells(1).Value = lst(i).Uri.Id '好友ID
Me.Grid_FriendList.Rows(i).Cells(2).Value = lst(i).PersonalInfo.MobileNo '手机号码
'用户状态
Next
End Sub
[本日志由 tiancao1001 于 2009-03-28 11:00 PM 编辑]
|
jesperzx 于 2010-07-26 09:44 AM 发表评论:
很不幸啊,fetion sdk已经被封了,还不知道什么时候可以重新用,大家有什么好的办法登陆飞信阿,谢谢lz了
leijinhua 于 2010-05-06 10:47 PM 发表评论:
邮箱:905226787@qq.com
l_o_ng 于 2010-04-27 08:55 PM 发表评论:
Partial Class _Default
Inherits System.Web.UI.MobileControls.MobilePage
Dim fetion As New NullStudio.Fetion_SDK.FetionSDK
Protected Sub Command1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Command1.Click
fetion.AccountManager.FillUserIdAndPassword(Me.TextBox1.Text, Me.TextBox2.Text, False)
System.Threading.Thread.Sleep(500)
Dim i As Short
i = fetion.AccountManager.Login()
System.Threading.Thread.Sleep(500)
If i = -1 Then
ActiveForm = Form2
End If
ActiveForm = Form1
End Sub
End Class
fetion.AccountManager.FillUserIdAndPassword(Me.TextBox1.Text, Me.TextBox2.Text, False)
提示:用户代码未处理nullReferenceException.
怎么回事呢?lz我的qq是605355232,加我qq聊下了
l_o_ng 于 2010-04-26 10:54 AM 发表评论:
邮箱l_o_ng@yeah.net
tiancao1001 于 2010-01-29 05:46 PM 发表评论:
AddHandler Fetion.SDK_ReceiveMessage, AddressOf sdk_SDK_ReceiveMessage
Public Sub sdk_SDK_ReceiveMessage(ByVal sender As Object, ByVal fe As NullStudio.Fetion_SDK.Event.SDK_ReceiveMessageEventArgs)
Me.TextBox_ReceiveMessage.Text = Me.TextBox_ReceiveMessage.Text & _
fe.Contact.DisplayName & vbCrLf & _
" " & fe.Message & vbCrLf
End Sub
thunderming 于 2010-01-27 04:35 PM 发表评论:
SDK_ReceiveMessage事件好像没有触发啊。怎么回事?
tiancao1001 于 2009-02-18 02:46 PM 发表评论:
我的QQ号码:327750885
podvcd 于 2009-02-18 02:22 PM 发表评论:
i = fetion.ContactControl.SendIM.SendIM(Me.Txt_SendID.Text.ToString, Me.Txt_SendContent.Text.ToString)
Else
i = fetion.ContactControl.SendSMS.SendSMS(Me.Txt_SendID.Text.ToString, Me.Txt_SendContent.Text.ToString)
End If
Me.Btn_SendIM.Enabled = False
System.Threading.Thread.Sleep(1000)
您的代码因为是同步的,所以这里不需要sleep同样可以得到返回值i
另外想问下 有没有这个sdk 的说明文档,里面很多方法没有说明文档使用不来。如果知道发我邮箱吧 podvcd@hotmail.com谢谢
podvcd 于 2009-02-18 11:39 AM 发表评论:
podvcd 于 2009-02-18 11:21 AM 发表评论:
lst = fetion.ContactControl.getAllContactList '我不知道该怎么定义这个类型
应该这样定义
Dim lst As List(Of Contact)
lst = fetion.ContactControl.getAllContactList '我不知道该怎么定义这个类型
Contact包含在命名空间
Imports Imps.Client.Core
发表评论 - 不要忘了输入验证码哦! |