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 / pinlex.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-01-22  |  3.6 KB  |  129 lines

  1. VERSION 4.00
  2. Begin VB.Form PinLex 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H80000005&
  5.    Caption         =   "Parsing Demonstration"
  6.    ClientHeight    =   3960
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1770
  9.    ClientWidth     =   6405
  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          =   4650
  21.    Left            =   1035
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   3960
  24.    ScaleWidth      =   6405
  25.    Top             =   1140
  26.    Width           =   6525
  27.    Begin VB.TextBox Text1 
  28.       Appearance      =   0  'Flat
  29.       Height          =   315
  30.       Left            =   3000
  31.       TabIndex        =   2
  32.       Top             =   3060
  33.       Width           =   2775
  34.    End
  35.    Begin VB.CommandButton cmdNext 
  36.       Appearance      =   0  'Flat
  37.       BackColor       =   &H80000005&
  38.       Caption         =   "Next"
  39.       Default         =   -1  'True
  40.       Height          =   495
  41.       Left            =   360
  42.       TabIndex        =   1
  43.       Top             =   3120
  44.       Width           =   1335
  45.    End
  46.    Begin VB.ListBox List1 
  47.       Appearance      =   0  'Flat
  48.       Height          =   2565
  49.       Left            =   360
  50.       TabIndex        =   0
  51.       Top             =   240
  52.       Width           =   4695
  53.    End
  54.    Begin MSComDlg.CommonDialog CMDialog1 
  55.       Left            =   5520
  56.       Top             =   240
  57.       _version        =   65536
  58.       _extentx        =   847
  59.       _extenty        =   847
  60.       _stockprops     =   0
  61.       cancelerror     =   -1  'True
  62.       filter          =   "VB Modules|*.FRM;*.BAS|INI Files|*.INI"
  63.       flags           =   4100
  64.    End
  65.    Begin VB.Label Label1 
  66.       Alignment       =   1  'Right Justify
  67.       Appearance      =   0  'Flat
  68.       BackColor       =   &H80000005&
  69.       Caption         =   "Manual:"
  70.       ForeColor       =   &H80000008&
  71.       Height          =   255
  72.       Left            =   2100
  73.       TabIndex        =   3
  74.       Top             =   3120
  75.       Width           =   855
  76.    End
  77.    Begin VB.Menu mnuFile 
  78.       Caption         =   "File"
  79.    End
  80. Attribute VB_Name = "PinLex"
  81. Attribute VB_Creatable = False
  82. Attribute VB_Exposed = False
  83. Option Explicit
  84. Dim FileHandle%
  85. Private Sub cmdNext_Click()
  86.     ParseALine
  87. End Sub
  88. Private Sub Form_Load()
  89.     FileHandle% = -1
  90.     Initialize
  91. End Sub
  92. Private Sub Form_Unload(Cancel As Integer)
  93.     If FileHandle% >= 0 Then Close FileHandle%
  94. End Sub
  95. Private Sub mnuFile_Click()
  96.     On Error GoTo cancelled
  97.     cmDialog1.Action = 1
  98.     If FileHandle% >= 0 Then
  99.         Close #FileHandle%
  100.     End If
  101.     FileHandle% = FreeFile
  102.     Open cmDialog1.filename For Input As FileHandle%
  103.     ParseALine
  104.     Exit Sub
  105. cancelled:
  106.         Exit Sub
  107. End Sub
  108. Private Sub ParseALine()
  109.     Dim s$, res%
  110.     List1.Clear
  111.     If Len(Text1.Text) > 0 Then
  112.         s$ = Text1.Text
  113.         Text1.Text = ""
  114.     Else
  115.         If FileHandle% < 0 Then
  116.             MsgBox "File not yet open"
  117.             Exit Sub
  118.         End If
  119.         If EOF(FileHandle%) Then
  120.             List1.AddItem "End of File"
  121.             Exit Sub
  122.         End If
  123.         Line Input #FileHandle%, s$
  124.     End If
  125.     While s$ <> ""
  126.         List1.AddItem GetToken1(s$, res%)
  127.     Wend
  128. End Sub
  129.