home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / articles / vbdev / source / pin5b.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-22  |  2.2 KB  |  61 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Read a line of text"
  6.    ClientHeight    =   3705
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1485
  9.    ClientWidth     =   4335
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   4110
  21.    Left            =   1035
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   3705
  24.    ScaleWidth      =   4335
  25.    Top             =   1140
  26.    Width           =   4455
  27.    Begin VB.CommandButton cmdReadLine 
  28.       Appearance      =   0  'Flat
  29.       BackColor       =   &H80000005&
  30.       Caption         =   "Read Line 2"
  31.       Height          =   495
  32.       Left            =   1200
  33.       TabIndex        =   1
  34.       Top             =   2700
  35.       Width           =   2115
  36.    End
  37.    Begin VB.TextBox txtControl 
  38.       Appearance      =   0  'Flat
  39.       Height          =   1455
  40.       Left            =   300
  41.       MultiLine       =   -1  'True
  42.       TabIndex        =   0
  43.       Text            =   "PIN5B.frx":0000
  44.       Top             =   660
  45.       Width           =   3615
  46.    End
  47. Attribute VB_Name = "Form1"
  48. Attribute VB_Creatable = False
  49. Attribute VB_Exposed = False
  50. Option Explicit
  51. Private Declare Function SendMessage Lib "USER" (ByVal hWnd As Integer, ByVal msg As Integer, ByVal wp As Integer, ByVal lp As Any) As Long
  52. Private Declare Function SendMessageByNum Lib "USER" Alias "SendMessage" (ByVal hWnd As Integer, ByVal msg As Integer, ByVal wp As Integer, ByVal lp As Any) As Long
  53. Const EM_GETLINE% = &H414
  54. Private Sub cmdReadLine_Click()
  55.     Dim result&
  56.     Mid$(mt.typebuffer, 1, 1) = Chr$(60 And &HFF) ' First byte is the low 8 bits
  57.     Mid$(mt.typebuffer, 2, 1) = Chr$(60 \ 256)    ' Second byte is the high 8 bits
  58.     result = SendMessageByNum(txtControl.hWnd, EM_GETLINE, 2, mt.typebuffer)
  59.     MsgBox "result= " & Str$(result) & " line= " & mt.typebuffer
  60. End Sub
  61.