Option Explicit
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
Const EM_LINEFROMCHAR = &HC9
Const EM_LINEINDEX = &HBB
Const EM_GETLINE = &HC4
Private Sub cmd_Click()
Dim astr As String
Dim l As Long, iLineY As Long
astr = Space(1024)
l = SendMessage(Text2.Text, EM_LINEINDEX, -1, 0)
iLineY = SendMessage(Text2.Text, EM_LINEFROMCHAR, l, 0)
l = SendMessage(Text2.Text, EM_GETLINE, iLineY, ByVal astr)
Text1.Text = CStr(astr)
End Sub
Private Sub Form_Load()
End Sub
你试试~
在Text2中输入句柄~
我测试了VB和Delphi的程序都可以~VC没有通过
研究一下