新建From1,新建Command1(按钮CommandButton),Text1(TextBox)代码:
Private Declare Function SendMessageLong Lib _
"user32" Alias "SendMessageA" _
( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Sub Command1_Click()
Dim lineCount As Integer
lineCount = SendMessageLong(Text1.hwnd, EM_GETLINECOUNT, 0&, 0&)
MsgBox Str(lineCount), vbInformation + vbOKOnly, "行数"
End Sub