各位,我用VB写了一个发短信的小程序,能发单条短息,现在想实现群发。在判断发送的每条短信是否成功,也就是判断MSCOMM控件缓存区中是否返加OK或ERROR时读不出缓存中的数据。如何读取MSCOMM控件缓存区中的数据?我用的INPUT方法读不出来,要怎么用,在什么地方用?请各位指教!急!!!

解决方案 »

  1.   

    Public Function ProcReturnData(ByVal lngSleepTime As Long, ByRef strTempReturnString As String) As Boolean
        ProcReturnData = False
        
        On Error Resume Next
        
        Dim Buffer() As Byte 
        Dim i As Long
        Dim stem2, sTem1 As String
        
        Sleep lngSleepTime
        
        Buffer = frmMain.MSComm1.Input
        'Sleep (1000)
        stem2 = ""
        sTem1 = ""
            For i = 0 To UBound(Buffer())
                ReDim stem(UBound(Buffer)) As String
                'stem2 = stem2 & Right("00" & Hex(Buffer(i)), 2) 
                sTem1 = sTem1 & Chr(Buffer(i))
            Next i        'Debug.Print sTem1
            
                  'If Check1.Value = 0 Then
               'Text1.Text = Text1.Text & sTem1
            '   Else
            '   Text1.Text = Text1.Text & stem2
            'End If
            
            strTempReturnString = sTem1
        ProcReturnData = True
    End Function
      

  2.   

    INPUT 应该没什么问题的  能读出来,实在不行加上SLEEP,要不换台机器 试试