Static i As Integer
Dim str(256) As Byte
Dim strLine As String
Dim intLen As Integer
Static strSend As Stringstr(1) = 1
If i = intCnt Then
i = 0
strSend = ""
Timer1.Enabled = False
Exit Sub
End Ifi = i + 1
'Debug.Print SendMessage(Text1.hwnd, EM_GETTEXTRANGE, 3, eText)
intLen = SendMessage(Text1.hwnd, EM_GETLINE, i - 1, str(0))
strLine = StrConv(str, vbUnicode)
strLine = Left(strLine, intLen) & vbCrLf
'Debug.Print "|" & strLine & "|"
strSend = strSend & strLine
'SendMessage b, WM_SETTEXT, 0, ByVal strSend这是一个卓行读取文本的代码,不过我看不懂,尤其是这段
str(1) = 1
If i = intCnt Then
i = 0
strSend = ""
Timer1.Enabled = False
Exit Sub
End If麻烦那位大虾把这些代码每句都给我解释解释,好吗?
十分感谢
http://www.cs.ecnu.edu.cn/xuesheng/davy/SendMessage.htm
很详细,我就不一句一句解释了
str(1) = 1
If i = intCnt Then
i = 0
strSend = ""
Timer1.Enabled = False
Exit Sub
End If
If i = intCnt Then
i = 0
strSend = ""
Timer1.Enabled = False
Exit Sub
End If上面是判断已经发送的行数是否等于文本框的总行数。
其中intCnt是已经取得的总行数,i是用来循环记数的已经发送的行数,如果已发送=总行数,则退出。
i = i + 1 ' 标记加1
'Debug.Print SendMessage(Text1.hwnd, EM_GETTEXTRANGE, 3, eText)
intLen = SendMessage(Text1.hwnd, EM_GETLINE, i - 1, str(0)) '获得行宽和文本
strLine = StrConv(str, vbUnicode) '字符串转换
strLine = Left(strLine, intLen) & vbCrLf '取得该行文本
'Debug.Print "|" & strLine & "|"
strSend = strSend & strLine '生成要发送的文本
'SendMessage b, WM_SETTEXT, 0, ByVal strSend '发送文本到别的窗口
~~~~~~~~~这个画线的代码查不到,什么意思,在这里起什么作用?谢谢