cag 发表于 2006-10-30 14:28:00

[求助]如何返回VB6中TextBox中某一行的字符?

<P>Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long<BR></P>
<P>Function GetLineText(CTextBox As TextBox, LineIndex As Long) As String <BR> Dim lc&amp;, linechar&amp; <BR> linechar = SendMessageBynum(CTextBox.hwnd, EM_LINEINDEX, LineIndex, 0) <BR> lc = SendMessageBynum(CTextBox.hwnd, EM_LINELENGTH, linechar, 0) + 1 <BR> GetLineText = String$(lc + 2, 0) <BR> Mid$(GetLineText, 1, 1) = Chr(lc And &amp;HFF) <BR> Mid$(GetLineText, 2, 1) = Chr(lc \ &amp;H100) <BR> lc = SendMessageBystring(CTextBox.hwnd, EM_GETLINE, LineIndex, GetLineText) <BR> GetLineText = left(GetLineText, lc) <BR>End Function</P>

<P>如上函数,如何声明SendMessageBynum和SendMessageBystring???</P>
<P>谢!</P>
页: [1]
查看完整版本: [求助]如何返回VB6中TextBox中某一行的字符?