home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Read a line of text"
- ClientHeight = 3705
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 4335
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H80000008&
- Height = 4110
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 3705
- ScaleWidth = 4335
- Top = 1140
- Width = 4455
- Begin VB.CommandButton cmdReadLine
- Appearance = 0 'Flat
- BackColor = &H80000005&
- Caption = "Read Line 2"
- Height = 495
- Left = 1200
- TabIndex = 1
- Top = 2700
- Width = 2115
- End
- Begin VB.TextBox txtControl
- Appearance = 0 'Flat
- Height = 1455
- Left = 300
- MultiLine = -1 'True
- TabIndex = 0
- Text = "PIN5C.frx":0000
- Top = 660
- Width = 3615
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Declare Function SendMessage Lib "USER" (ByVal hWnd As Integer, ByVal msg As Integer, ByVal wp As Integer, ByVal lp As Long) As Long
- Const EM_GETLINE% = &H414
- Private Declare Function agGetAddressForLPSTR& Lib "Apiguide.dll" Alias "agGetAddressForObject" (ByVal lpstring$)
- Private Sub cmdReadLine_Click()
- Dim result&
- Dim buffer As String
- buffer = String$(60, 0) ' Initialize buffer
- Mid$(buffer$, 1, 1) = Chr$(60 And &HFF) ' First byte is the low 8 bits
- Mid$(buffer$, 2, 1) = Chr$(60 \ 256) ' Second byte is the high 8 bits
- result = SendMessage(txtControl.hWnd, EM_GETLINE, 2, agGetAddressForLPSTR(buffer$))
- MsgBox "result= " & Str$(result) & " line= " & buffer$
- End Sub
-