我在模块里定义了这些函数,在窗口中如何调用?
'启动服务,打开串口,初始化Modem, 0为失败,非0为成功
'校验位, EvenParity :0,MarkParity:1,NoParity:2,OddParity:3,SpaceParity,4
'停止位 OneStopBit 0,OnePointFiveStopBits:1,TwoStopBits 2
'流控:NoFlowControl:0, CtsRtsFlowControl:1, CtsDtrFlowControl:2, DsrRtsFlowControl:3, DsrDtrFlowControl:4, XonXoffFlowControl:5
'最后一个参数csca为短信中心号码,如果直接用卡内已存的短信中心号码则用"card"(小写)
Public Declare Function SMSStartService Lib "SMSDLL.dll" (ByVal nPort As Long, ByVal BaudRate As Long, ByVal Parity As Integer, ByVal DataBits As Integer, ByVal StopBits As Integer, ByVal FlowControl As Integer, ByVal csca As String) As Long
这样可以对吗?
SMSStartService 1, 115200, 2, 8, 0, 0, card这个就不知道怎么调用了
Public Type SMSMessageStruct
Msg(0 To 255) As Byte '//短信内容
PhoneNo(0 To 31) As Byte '//对方手机号码
ReceTime(0 To 31) As Byte '//接收时间
End TypePublic Declare Function SMSGetNextMessage Lib "SMSDLL.dll" (ByRef smg As SMSMessageStruct) As Long请高手指教,最好能给个源码,谢谢
'启动服务,打开串口,初始化Modem, 0为失败,非0为成功
'校验位, EvenParity :0,MarkParity:1,NoParity:2,OddParity:3,SpaceParity,4
'停止位 OneStopBit 0,OnePointFiveStopBits:1,TwoStopBits 2
'流控:NoFlowControl:0, CtsRtsFlowControl:1, CtsDtrFlowControl:2, DsrRtsFlowControl:3, DsrDtrFlowControl:4, XonXoffFlowControl:5
'最后一个参数csca为短信中心号码,如果直接用卡内已存的短信中心号码则用"card"(小写)
Public Declare Function SMSStartService Lib "SMSDLL.dll" (ByVal nPort As Long, ByVal BaudRate As Long, ByVal Parity As Integer, ByVal DataBits As Integer, ByVal StopBits As Integer, ByVal FlowControl As Integer, ByVal csca As String) As Long
这样可以对吗?
SMSStartService 1, 115200, 2, 8, 0, 0, card这个就不知道怎么调用了
Public Type SMSMessageStruct
Msg(0 To 255) As Byte '//短信内容
PhoneNo(0 To 31) As Byte '//对方手机号码
ReceTime(0 To 31) As Byte '//接收时间
End TypePublic Declare Function SMSGetNextMessage Lib "SMSDLL.dll" (ByRef smg As SMSMessageStruct) As Long请高手指教,最好能给个源码,谢谢
Msg(0 To 255) As Byte '//短信内容
PhoneNo(0 To 31) As Byte '//对方手机号码
ReceTime(0 To 31) As Byte '//接收时间
End Type
****************
这个是自定义的数据类型
定义一个数组转字符串函数'假设返回的是ansi编码
private function Conv(a() as byte)as string
dim i as long
for i=lbound(a) to ubound(a)
if a(i)=0 then
exit for
else
Conv=Conv & chr(a(i))
end if
next
end function调用位置dim a as SMSMessageStruct'定义一个结构
SMSGetNextMessage adim sContent as string
dim Phone as string
dim sTime as stringscontent=conv(a.msg)
Phone=conv(a.PhoneNum)
sTime=conv(a.recetime)