home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol12n18.zip / FONSRC.ZIP / FONEWORD.TXT < prev    next >
Text File  |  1993-07-27  |  22KB  |  716 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "FONEWORD"
  6.    ClientHeight    =   5370
  7.    ClientLeft      =   60
  8.    ClientTop       =   870
  9.    ClientWidth     =   7275
  10.    ForeColor       =   &H00000000&
  11.    Height          =   6300
  12.    Icon            =   FONEWORD.FRX:0000
  13.    Left            =   0
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    ScaleHeight     =   5370
  17.    ScaleWidth      =   7275
  18.    Top             =   0
  19.    Width           =   7395
  20.    Begin PushButton PushStop 
  21.       Height          =   615
  22.       HelpContextID   =   4
  23.       Left            =   6420
  24.       TabIndex        =   14
  25.       Top             =   120
  26.       Width           =   615
  27.    End
  28.    Begin PushButton PushOnly 
  29.       Height          =   615
  30.       HelpContextID   =   6
  31.       Left            =   1680
  32.       TabIndex        =   3
  33.       Top             =   1020
  34.       Width           =   615
  35.    End
  36.    Begin PushButton PushReal 
  37.       Height          =   615
  38.       HelpContextID   =   6
  39.       Left            =   4080
  40.       TabIndex        =   7
  41.       Top             =   1020
  42.       Width           =   615
  43.    End
  44.    Begin PushButton PushAll 
  45.       Height          =   615
  46.       HelpContextID   =   6
  47.       Left            =   6480
  48.       PictureDown     =   FONEWORD.FRX:0302
  49.       PictureUp       =   FONEWORD.FRX:0754
  50.       TabIndex        =   11
  51.       Top             =   1020
  52.       Width           =   615
  53.    End
  54.    Begin CommandButton CommandAll 
  55.       BackColor       =   &H00000080&
  56.       Caption         =   "&All words"
  57.       Height          =   615
  58.       HelpContextID   =   1
  59.       Left            =   5160
  60.       TabIndex        =   10
  61.       Top             =   1020
  62.       Width           =   1335
  63.    End
  64.    Begin CommandButton CommandReal 
  65.       Caption         =   "&Real words"
  66.       Height          =   615
  67.       HelpContextID   =   2
  68.       Left            =   2760
  69.       TabIndex        =   6
  70.       Top             =   1020
  71.       Width           =   1335
  72.    End
  73.    Begin CommandButton CommandOnly 
  74.       BackColor       =   &H00FF0000&
  75.       Caption         =   "&Only words"
  76.       Height          =   615
  77.       HelpContextID   =   3
  78.       Left            =   360
  79.       TabIndex        =   2
  80.       Top             =   1020
  81.       Width           =   1335
  82.    End
  83.    Begin ListBox ListAll 
  84.       FontBold        =   0   'False
  85.       FontItalic      =   0   'False
  86.       FontName        =   "Fixedsys"
  87.       FontSize        =   9
  88.       FontStrikethru  =   0   'False
  89.       FontUnderline   =   0   'False
  90.       Height          =   3180
  91.       HelpContextID   =   7
  92.       Left            =   5160
  93.       MultiSelect     =   2  'Extended
  94.       TabIndex        =   12
  95.       Top             =   1680
  96.       Width           =   1935
  97.    End
  98.    Begin ListBox ListReal 
  99.       FontBold        =   0   'False
  100.       FontItalic      =   0   'False
  101.       FontName        =   "Fixedsys"
  102.       FontSize        =   9
  103.       FontStrikethru  =   0   'False
  104.       FontUnderline   =   0   'False
  105.       Height          =   3180
  106.       HelpContextID   =   7
  107.       Left            =   2760
  108.       MultiSelect     =   2  'Extended
  109.       TabIndex        =   8
  110.       Top             =   1680
  111.       Width           =   1935
  112.    End
  113.    Begin ListBox ListOnly 
  114.       FontBold        =   0   'False
  115.       FontItalic      =   0   'False
  116.       FontName        =   "Fixedsys"
  117.       FontSize        =   9
  118.       FontStrikethru  =   0   'False
  119.       FontUnderline   =   0   'False
  120.       Height          =   3180
  121.       HelpContextID   =   7
  122.       Left            =   360
  123.       MultiSelect     =   2  'Extended
  124.       TabIndex        =   4
  125.       Top             =   1680
  126.       Width           =   1935
  127.    End
  128.    Begin ListBox ListCover 
  129.       FontBold        =   0   'False
  130.       FontItalic      =   0   'False
  131.       FontName        =   "Fixedsys"
  132.       FontSize        =   9
  133.       FontStrikethru  =   0   'False
  134.       FontUnderline   =   0   'False
  135.       ForeColor       =   &H00000000&
  136.       Height          =   255
  137.       Left            =   60
  138.       TabIndex        =   18
  139.       Top             =   60
  140.       Visible         =   0   'False
  141.       Width           =   195
  142.    End
  143.    Begin Gauge GaugeAll 
  144.       Autosize        =   -1  'True
  145.       BackColor       =   &H00C0C0C0&
  146.       ForeColor       =   &H0000FF00&
  147.       Height          =   4275
  148.       HelpContextID   =   8
  149.       InnerBottom     =   2
  150.       InnerLeft       =   1
  151.       InnerRight      =   2
  152.       InnerTop        =   2
  153.       Left            =   4920
  154.       Max             =   100
  155.       NeedleWidth     =   1
  156.       Style           =   1  'Vertical Bar
  157.       TabIndex        =   13
  158.       Top             =   960
  159.       Width           =   135
  160.    End
  161.    Begin Gauge GaugeReal 
  162.       Autosize        =   -1  'True
  163.       BackColor       =   &H00C0C0C0&
  164.       ForeColor       =   &H000000FF&
  165.       Height          =   4275
  166.       HelpContextID   =   8
  167.       InnerBottom     =   2
  168.       InnerLeft       =   1
  169.       InnerRight      =   2
  170.       InnerTop        =   2
  171.       Left            =   2520
  172.       Max             =   100
  173.       NeedleWidth     =   1
  174.       Style           =   1  'Vertical Bar
  175.       TabIndex        =   9
  176.       Top             =   960
  177.       Width           =   135
  178.    End
  179.    Begin Gauge GaugeOnly 
  180.       Autosize        =   -1  'True
  181.       BackColor       =   &H00C0C0C0&
  182.       ForeColor       =   &H00FF0000&
  183.       Height          =   4275
  184.       HelpContextID   =   8
  185.       InnerBottom     =   2
  186.       InnerLeft       =   1
  187.       InnerRight      =   2
  188.       InnerTop        =   2
  189.       Left            =   120
  190.       Max             =   100
  191.       NeedleWidth     =   1
  192.       Style           =   1  'Vertical Bar
  193.       TabIndex        =   5
  194.       Top             =   960
  195.       Width           =   135
  196.    End
  197.    Begin MaskEdBox PhoneEdit 
  198.       BackColor       =   &H00FFFFFF&
  199.       FontBold        =   -1  'True
  200.       FontItalic      =   0   'False
  201.       FontName        =   "MS Sans Serif"
  202.       FontSize        =   18
  203.       FontStrikethru  =   0   'False
  204.       FontUnderline   =   0   'False
  205.       ForeColor       =   &H00000000&
  206.       Height          =   555
  207.       HelpContextID   =   10
  208.       Left            =   2700
  209.       Mask            =   "###-####"
  210.       MaxLength       =   8
  211.       PromptChar      =   "_"
  212.       TabIndex        =   1
  213.       Top             =   120
  214.       Width           =   2055
  215.    End
  216.    Begin Image ImageStopDn 
  217.       Height          =   615
  218.       Left            =   5400
  219.       Picture         =   FONEWORD.FRX:0BA6
  220.       Top             =   0
  221.       Visible         =   0   'False
  222.       Width           =   615
  223.    End
  224.    Begin Image ImageDiStopDn 
  225.       Height          =   615
  226.       Left            =   5220
  227.       Picture         =   FONEWORD.FRX:0FF8
  228.       Top             =   0
  229.       Visible         =   0   'False
  230.       Width           =   615
  231.    End
  232.    Begin Image ImageDiStopUp 
  233.       Height          =   615
  234.       Left            =   5040
  235.       Picture         =   FONEWORD.FRX:144A
  236.       Top             =   0
  237.       Visible         =   0   'False
  238.       Width           =   615
  239.    End
  240.    Begin Image ImageStopUp 
  241.       Height          =   615
  242.       Left            =   4860
  243.       Picture         =   FONEWORD.FRX:189C
  244.       Top             =   0
  245.       Visible         =   0   'False
  246.       Width           =   615
  247.    End
  248.    Begin Line Line1 
  249.       X1              =   0
  250.       X2              =   7260
  251.       Y1              =   840
  252.       Y2              =   840
  253.    End
  254.    Begin Label LabelOnly 
  255.       BorderStyle     =   1  'Fixed Single
  256.       Height          =   255
  257.       Left            =   360
  258.       TabIndex        =   15
  259.       Top             =   4920
  260.       Width           =   1935
  261.    End
  262.    Begin Label LabelReal 
  263.       BorderStyle     =   1  'Fixed Single
  264.       Height          =   255
  265.       Left            =   2760
  266.       TabIndex        =   16
  267.       Top             =   4920
  268.       Width           =   1935
  269.    End
  270.    Begin Label LabelAll 
  271.       BorderStyle     =   1  'Fixed Single
  272.       Height          =   255
  273.       Left            =   5160
  274.       TabIndex        =   17
  275.       Top             =   4920
  276.       Width           =   1935
  277.    End
  278.    Begin Label LabelPhone 
  279.       Alignment       =   1  'Right Justify
  280.       Caption         =   "Enter Phone Number:"
  281.       Height          =   315
  282.       Left            =   240
  283.       TabIndex        =   0
  284.       Top             =   360
  285.       Width           =   2295
  286.    End
  287.    Begin Shape ShapeOnly 
  288.       BackColor       =   &H00FF0000&
  289.       BackStyle       =   1  'Opaque
  290.       BorderColor     =   &H00000000&
  291.       FillColor       =   &H00FF0000&
  292.       FillStyle       =   0  'Solid
  293.       Height          =   4275
  294.       Left            =   300
  295.       Top             =   960
  296.       Width           =   2055
  297.    End
  298.    Begin Shape ShapeReal 
  299.       BackColor       =   &H000000FF&
  300.       BackStyle       =   1  'Opaque
  301.       BorderColor     =   &H00000000&
  302.       FillColor       =   &H000000FF&
  303.       FillStyle       =   0  'Solid
  304.       Height          =   4275
  305.       Left            =   2700
  306.       Top             =   960
  307.       Width           =   2055
  308.    End
  309.    Begin Shape ShapeAll 
  310.       BackColor       =   &H0000FF00&
  311.       BackStyle       =   1  'Opaque
  312.       BorderColor     =   &H00000000&
  313.       FillColor       =   &H0000FF00&
  314.       FillStyle       =   0  'Solid
  315.       Height          =   4275
  316.       Left            =   5100
  317.       Top             =   960
  318.       Width           =   2055
  319.    End
  320.    Begin Menu MainMenu 
  321.       Caption         =   "&File"
  322.       HelpContextID   =   11
  323.       Index           =   1
  324.       Begin Menu FileMenu 
  325.          Caption         =   "E&xit"
  326.          HelpContextID   =   11
  327.          Index           =   1
  328.       End
  329.    End
  330.    Begin Menu MainMenu 
  331.       Caption         =   "&Help"
  332.       HelpContextID   =   5
  333.       Index           =   2
  334.       Begin Menu HelpMenu 
  335.          Caption         =   "&Contents"
  336.          HelpContextID   =   5
  337.          Index           =   101
  338.       End
  339.       Begin Menu HelpMenu 
  340.          Caption         =   "&Search for Help On..."
  341.          HelpContextID   =   5
  342.          Index           =   102
  343.       End
  344.       Begin Menu HelpMenu 
  345.          Caption         =   "&How to Use Help"
  346.          HelpContextID   =   5
  347.          Index           =   103
  348.       End
  349.       Begin Menu HelpMenu 
  350.          Caption         =   "-"
  351.          HelpContextID   =   5
  352.          Index           =   104
  353.       End
  354.       Begin Menu HelpMenu 
  355.          Caption         =   "&About FoneWord..."
  356.          HelpContextID   =   5
  357.          Index           =   105
  358.       End
  359.    End
  360. End
  361. Option Explicit
  362. ' A is an array of three letter values for each
  363. ' ASCII value from 50 ("2") to 57 ("9")
  364. Dim A(50 To 57, 0 To 2)
  365. Dim MyDB As database
  366. Dim MySet As DynaSet
  367. Dim Continue%
  368. Const MinWord = 2
  369. Const NullStr = ""
  370.  
  371. Declare Function WinHelpByNum% Lib "User" Alias "WinHelp" (ByVal hWnd%, ByVal lpHelpFile$, ByVal wCommand%, ByVal dwData&)
  372. Declare Function WinHelp% Lib "User" (ByVal hWnd%, ByVal lpHelpFile$, ByVal wCommand%, ByVal dwData$)
  373. Const HELP_CONTENTS = 3
  374. Const HELP_HELPONHELP = 4
  375. Const HELP_PARTIALKEY = &H105
  376.  
  377. Declare Sub MessageBeep Lib "User" (ByVal wType%)
  378.  
  379. Sub After (Lis As ListBox, Lab As Label)
  380.   PushStop.PictureUp = ImageDiStopUp.Picture
  381.   PushStop.PictureDown = ImageDiStopDn.Picture
  382.   Form1.MousePointer = 0
  383.   Lab.Caption = Lis.ListCount + " Items"
  384.   MessageBeep (0)
  385. End Sub
  386.  
  387. Sub AllCombos (ByVal S$, ByVal N%)
  388.   ' Called when button CommandAll is clicked
  389.   '
  390.   ' Recursive function.  Replaces the Nth digit of S with
  391.   ' each of the three possible letters, then calls itself
  392.   ' to handle the N+1th digit for each.  When it passes
  393.   ' the LAST digit, it records the completed combination
  394.   ' by adding it to a list box.
  395.   '
  396.   Dim Ch%
  397.   DoEvents
  398.   If Not Continue Then Exit Sub
  399.   If N > Len(S) Then
  400.     ListAll.AddItem S
  401.     GaugeAll.Value = ListAll.ListCount
  402.   Else
  403.     Ch = Asc(Mid$(S, N, 1))
  404.     If (Ch >= 50) And (Ch <= 57) Then
  405.       Mid$(S, N, 1) = A(Ch, 0)
  406.       AllCombos S, N + 1
  407.       Mid$(S, N, 1) = A(Ch, 1)
  408.       AllCombos S, N + 1
  409.       Mid$(S, N, 1) = A(Ch, 2)
  410.       AllCombos S, N + 1
  411.     Else
  412.       AllCombos S, N + 1
  413.     End If
  414.   End If
  415. End Sub
  416.  
  417. Sub Before (Lis As ListBox, Lab As Label)
  418.   Continue = True
  419.   Lis.Clear
  420.   Lab.Caption = NullStr
  421.   Form1.MousePointer = 11
  422.   PushStop.PictureUp = ImageStopUp.Picture
  423.   PushStop.PictureDown = ImageStopDn.Picture
  424. End Sub
  425.  
  426. Sub CommandAll_Click ()
  427.   Dim N%
  428.   If Len(PhoneEdit.ClipText) = 0 Then Exit Sub
  429.   GaugeAll.Max = 1
  430.   ' Set the max value for the gauge to the number
  431.   ' of possible combinations, which is 3 to the nth
  432.   ' power, where n is the number of digits in the
  433.   ' input string that are NOT "1" or "0"
  434.   For N = 1 To Len(PhoneEdit.ClipText)
  435.     Select Case Mid$(PhoneEdit.ClipText, N, 1)
  436.       Case "0"
  437.       Case "1"
  438.       Case Else
  439.         GaugeAll.Max = GaugeAll.Max * 3
  440.     End Select
  441.   Next N
  442.   ' Cover the list box with a blank list box and fill
  443.   ' the list while not visible - that makes it fill
  444.   ' up MUCH faster
  445.   ListCover.Visible = True
  446.   ListAll.Visible = False
  447.   Before ListAll, LabelAll
  448.   AllCombos PhoneEdit.ClipText, 1
  449.   ListAll.Visible = True
  450.   ListCover.Visible = False
  451.   After ListAll, LabelAll
  452. End Sub
  453.  
  454. Sub CommandOnly_Click ()
  455.   If Len(PhoneEdit.ClipText) = 0 Then Exit Sub
  456.   GaugeOnly.Max = Len(PhoneEdit.ClipText) + 1
  457.   GaugeOnly.Value = 0
  458.   Before ListOnly, LabelOnly
  459.   OnlyRealWords PhoneEdit.ClipText, NullStr
  460.   After ListOnly, LabelOnly
  461. End Sub
  462.  
  463. Sub CommandReal_Click ()
  464.   If Len(PhoneEdit.ClipText) = 0 Then Exit Sub
  465.   If Len(PhoneEdit.ClipText) < MinWord Then
  466.     MsgBox "You must enter at least " + Str$(MinWord) + " digits", 0, "FoneWord Message"
  467.     Exit Sub
  468.   End If
  469.   Before ListReal, LabelReal
  470.   FindRealWords
  471.   After ListReal, LabelReal
  472. End Sub
  473.  
  474. Function Decode$ (ByVal S$, ByVal Code%)
  475.   ' This function receives a string of digits from 2 to 9
  476.   ' and an integer that tells how to decode those digits
  477.   ' into a real word.  It repeatedly divides the code by
  478.   ' 3 and uses the remainder as an index into the A array,
  479.   ' selecting the first, second, or third letter associated
  480.   ' with the current digit.
  481.   Dim N%, TempS$
  482.   If (Len(S) = 1) And InStr("01", S) Then
  483.     Decode = S
  484.   Else
  485.     TempS = NullStr
  486.     For N = 1 To Len(S)
  487.       TempS = TempS + A(Asc(Mid$(S, N, 1)), Code Mod 3)
  488.       Code = Code \ 3
  489.     Next N
  490.     Decode = TempS
  491.   End If
  492. End Function
  493.  
  494. Sub FileMenu_Click (Index As Integer)
  495.   ' Handles the Exit choice from the File menu
  496.   If Index = 1 Then End
  497. End Sub
  498.  
  499. Sub FindRealWords ()
  500.   ' Called when you press the CommandReal button.
  501.   '
  502.   ' Considers every substring of the phone number that's
  503.   ' at least MinWord in length.  If it's in the database,
  504.   ' decodes it into a word and adds the result to the list.
  505.   ' Then it checks for other words made from the same
  506.   ' digits.  The key values for these other words will
  507.   ' be the same as the original number with A, B, C
  508.   ' and so on appended in turn.
  509.   Dim Start%, Num%, vLen%, Code%
  510.   Dim S$, SPart$, SDecode$
  511.   Dim Char As String * 1
  512.   vLen = Len(PhoneEdit.ClipText)
  513.   GaugeReal.Max = 1
  514.   For Num = MinWord To vLen
  515.     For Start = 1 To (vLen + 1 - Num)
  516.       GaugeReal.Max = GaugeReal.Max + 1
  517.     Next Start
  518.   Next Num
  519.   GaugeReal.Value = 0
  520.   For Num = MinWord To vLen
  521.     For Start = 1 To (vLen + 1 - Num)
  522.       GaugeReal.Value = GaugeReal.Value + 1
  523.       DoEvents
  524.       If Not Continue Then Exit Sub
  525.       SPart = Mid$(PhoneEdit.ClipText, Start, Num)
  526.       Char = "@"
  527.       SDecode = NextMatch(SPart, Char)
  528.       Do While Len(SDecode) <> 0
  529.         DoEvents
  530.         If Not Continue Then Exit Sub
  531.         S = NullStr
  532.         If Start > 1 Then S = Mid$(PhoneEdit.ClipText, 1, Start - 1) + " "
  533.         S = S + SDecode
  534.         If Start + Num <= vLen Then S = S + " " + Mid$(PhoneEdit.ClipText, Start + Num)
  535.         ListReal.AddItem S
  536.         SDecode = NextMatch(SPart, Char)
  537.       Loop
  538.     Next Start
  539.   Next Num
  540.   GaugeReal.Value = GaugeReal.Value + 1
  541. End Sub
  542.  
  543. Sub Form_Load ()
  544.   SetDataAccessOption 1, App.Path + "\FONEWORD.INI"
  545.   Dim X%, Y%
  546.   ' Since we can't have multi-dimensional array constants,
  547.   ' we assign values to the array A here.
  548.   Const FoneLets$ = "ABCDEFGHIJKLMNOPRSTUVWXY"
  549.   For X = 0 To 7
  550.     For Y = 0 To 2
  551.       A(X + Asc("2"), Y) = Mid(FoneLets, X * 3 + Y + 1, 1)
  552.     Next Y
  553.   Next X
  554.   Set MyDB = OpenDatabase(CurDir$, True, True, "Paradox;")
  555.   Const DB_READONLY = 4
  556.   Set MySet = MyDB.CreateDynaset("FONENUMS", DB_READONLY)
  557.   ListCover.Move ListAll.Left, ListAll.Top, ListAll.Width, ListAll.Height
  558.   ListCover.AddItem "One"
  559.   ListCover.AddItem "Moment"
  560.   ListCover.AddItem "Please..."
  561.   ' Some pictures are stored separately in invisible image
  562.   ' image controls, so as to avoid either having independent
  563.   ' BMP file or storing multiple copies of the same bitmap
  564.   ' in the EXE.
  565.   PushReal.PictureDown = PushAll.PictureDown
  566.   PushReal.PictureUp = PushAll.PictureUp
  567.   PushOnly.PictureDown = PushAll.PictureDown
  568.   PushOnly.PictureUp = PushAll.PictureUp
  569.   PushStop.PictureDown = ImageDiStopDn.Picture
  570.   PushStop.PictureUp = ImageDiStopUp.Picture
  571. End Sub
  572.  
  573. Sub HelpMenu_Click (Index As Integer)
  574.   ' Note that WinHelp and WinHelpByNum are declared in
  575.   ' the declarations section, to give this VB program
  576.   ' access to the Windows API function WinHelp.
  577.   Dim Success%
  578.   Select Case Index
  579.     Case 101
  580.       Success = WinHelpByNum(Form1.hWnd, App.HelpFile, HELP_CONTENTS, 0)
  581.     Case 102
  582.       Success = WinHelp(Form1.hWnd, App.HelpFile, HELP_PARTIALKEY, "")
  583.     Case 103
  584.       Success = WinHelpByNum(Form1.hWnd, App.HelpFile, HELP_HELPONHELP, 0)
  585.     Case 105
  586.       Form2.Show
  587.   End Select
  588. End Sub
  589.  
  590. Function NextMatch$ (ByVal S$, C$)
  591.   ' Called by FindRealWords and OnlyRealWords
  592.   '
  593.   ' Handles the fact that multiple decodings of the same
  594.   ' string of digits exist.  The first is keyed with the
  595.   ' digit string itself, and the later ones have A, B,
  596.   ' C, and so on appended in turn.
  597.   Dim Criteria$, Code%
  598.   NextMatch = NullStr
  599.   If C = "?" Then Exit Function
  600.   If Len(S) = 1 Then
  601.     ' deal with single-digit "words" w/o hitting database
  602.     Select Case S
  603.       Case "0", "1"
  604.         NextMatch = S
  605.       Case "2"
  606.         NextMatch = "A"
  607.       Case "4"
  608.         NextMatch = "I"
  609.       Case "^"
  610.         NextMatch = "O"
  611.     End Select
  612.     C = "?"
  613.   Else
  614.     If C = "@" Then
  615.       Criteria = "Foneword = '" + S + "'"
  616.     Else
  617.       Criteria = "Foneword = '" + S + C + "'"
  618.     End If
  619.     MySet.FindFirst Criteria
  620.     If Not MySet.NoMatch Then
  621.       Code = MySet("Code")
  622.       NextMatch = Decode(S, Code)
  623.     End If
  624.     C = Chr$(Asc(C) + 1)
  625.   End If
  626. End Function
  627.  
  628. Sub OnlyRealWords (ByVal S$, ByVal SAcc$)
  629.   ' Called when you press the CommandOnly button
  630.   '
  631.   ' Checks each prefix of the passed string to see if it's
  632.   ' a word.  If so, adds the decoded word to the accumulator
  633.   ' string SAcc and calls itself recursively to handle the
  634.   ' remainder of the string.  Only of the string is entirely
  635.   ' converted to words does it add the result to the list.
  636.   Dim N%, SPart$, SDecode$
  637.   Dim Char As String * 1
  638.   If Not Continue Then Exit Sub
  639.   For N = 1 To Len(S)
  640.     ' Only advance the gauge for the first instance
  641.     If Len(SAcc) = 0 Then GaugeOnly.Value = GaugeOnly.Value + 1
  642.     DoEvents
  643.     If Not Continue Then Exit Sub
  644.     SPart = Mid$(S, 1, N)
  645.     Char = "@"
  646.     SDecode = NextMatch(SPart, Char)
  647.     Do While Len(SDecode) <> 0
  648.       DoEvents
  649.       If Not Continue Then Exit Sub
  650.       If N = Len(S) Then
  651.         ListOnly.AddItem Mid$(SAcc + " " + SDecode, 2)
  652.       Else
  653.         OnlyRealWords Mid$(S, N + 1), SAcc + " " + Left$(SDecode, N)
  654.       End If
  655.       SDecode = NextMatch(SPart, Char)
  656.     Loop
  657.   Next N
  658.   ' Only advance the gauge for the first instance
  659.   If Len(SAcc) = 0 Then GaugeOnly.Value = GaugeOnly.Value + 1
  660. End Sub
  661.  
  662. Sub PhoneEdit_Change ()
  663.   ListAll.Clear
  664.   ListReal.Clear
  665.   ListOnly.Clear
  666.   'DO NOT add ListCover.Clear
  667.   LabelAll.Caption = NullStr
  668.   LabelReal.Caption = NullStr
  669.   LabelOnly.Caption = NullStr
  670.   GaugeAll.Value = 0
  671.   GaugeReal.Value = 0
  672.   GaugeOnly.Value = 0
  673. End Sub
  674.  
  675. Sub PushAll_Click (ButtonCaption As String)
  676.   ToClip ListAll
  677. End Sub
  678.  
  679. Sub PushOnly_Click (ButtonCaption As String)
  680.   ToClip ListOnly
  681. End Sub
  682.  
  683. Sub PushReal_Click (ButtonCaption As String)
  684.   ToClip ListReal
  685. End Sub
  686.  
  687. Sub PushStop_Click (ButtonCaption As String)
  688.   ' All three lengthy functions check to see if Continue
  689.   ' becomes FALSE, and stop if so.  Thus clicking this
  690.   ' button interrupts the lengthy processing.
  691.   Continue = False
  692. End Sub
  693.  
  694. Sub ToClip (L As ListBox)
  695.   ' Called when you press one of the clipboard buttons
  696.   '
  697.   ' Copies the selected items from the associated list
  698.   ' box to the clipboard.
  699.   Dim N%, Text$
  700.   Text = NullStr
  701.   If L.ListCount = 0 Then Exit Sub
  702.   For N = 0 To L.ListCount - 1
  703.     If L.Selected(N) Then
  704.       Text = Text + L.List(N)
  705.       Text = Text + Chr$(13) + Chr$(10)
  706.     End If
  707.   Next N
  708.   If Len(Text) = 0 Then
  709.     MsgBox "No items are selected", 0
  710.   Else
  711.     Clipboard.Clear
  712.     Clipboard.SetText Text
  713.   End If
  714. End Sub
  715.  
  716.