关于SMS短信猫引用程序集的问题
我这边买了一套SMS短信猫的设备, 设备里面附加了一份光碟,是开发的源码
然后我运行他们提供的源码例子, 是可以正常工作的 sms短信也是可以发到我手机上
现在我要把这个发短信的功能做到我写的程序里面去! 也是从那边复制过来的代码, sms短信猫设备竟然连接不成功!
下面是点击连接的代码:
Private Sub btnCon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCon.Click
'UPGRADE_ISSUE: 不支持 Load 语句。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1039"'
'Load(Me)
'UPGRADE_WARNING: Screen 属性 Screen.MousePointer 具有新的行为。 单击以获得更多信息:'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2065"'
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
btnCon.Enabled = False
Dim TypeStr As String
Dim CopyRightToCOMStr As String
Dim CopyRightStr As String
CopyRightStr = "//12345678//"
If Sms_Connection(CopyRightStr, CShort(MobPort.Text), 9600, TypeStr, CopyRightToCOMStr) Then 'State_Show.Text = "连接短信猫成功" & Chr(10) & "(短信猫型号为:" & TypeStr & ")"
MsgBox("连接短信猫成功" & Chr(10) & "(短信猫型号为:" & TypeStr & ")", MsgBoxStyle.Information, "提示")
Else
'State_Show.Text = "连接短信猫失败" & Chr(10) & "(请重新连接短信猫)"
'Sms_Connection_Button.Enabled = True
MsgBox("连接短信猫失败" & Chr(10) & "(请重新连接短信猫)", MsgBoxStyle.Critical, "警告")
End If
btnCon.Enabled = True
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
End Sub
下面是Module的代码
Option Strict Off
Option Explicit On
Module loadsms
'短信收发二次开发接口(标准版)函数使用说明
'Sms_Connection函数说明如下:
'功能描述:用于初始化移动电话与串口的连接
'Com_Port:串口号
'Com_BaudRate:波特率
'Mobile_Type:返回移动电话型号
'Sms_Connection:返回值(0:连接移动电话失败;1:连接移动电话成功)
'******************************************************
Public Declare Function Sms_Connection Lib "sms.dll" (ByVal CopyRight As String, ByVal Com_Port As Short, ByVal Com_BaudRate As Short, ByRef Mobile_Type As String, ByRef CopyRightToCOM As String) As Integer
End Module
他们提供的sms。dll在项目中,我以为添加引用sms.dll就可以了 但是这个sms。dll引用不了,提示“请确保文件可访问并且是一个有效的程序集或COM组件”
请问下怎么解决这个问题呀! 急急急
[解决办法]
直接把这个sms。dll拷贝到你bin Debug目录下就可以了