home *** CD-ROM | disk | FTP | other *** search
- DefInt A-Z
- ' DefaultElements is the number of lines this
- ' module will remember if you don't call the
- ' MhInitKeyBuff routine.
- Const DefaultElements = 50
- Dim MaxElements As Integer
- ' So we don't add the stuffed keys back to the buffer
- Dim JustStuffedOne As Integer
-
- Sub MhInitKeyBuff (Elements%)
-
- ' Call this sub to initialize or re-intialize
- ' the buffer. Note that re-initializing it will
- ' cause you to lose the existing contents.
- MaxElements = Elements
- MhClearKeyBuff
-
- End Sub
-
- Sub MhStoreText (TextLine$)
-
- ' Call this sub to store one command line for later
- ' recall.
- Dim I As Integer
-
- If Len(TextLine$) Then ' Only store if some length
- ' If you didn't call the init routine, we need to
- ' use our defaults.
- If MaxElements = 0 Then
- MaxElements = DefaultElements
- End If
- ' We wouldn't want to add the same
- ' text back to the buffer, right?
- If JustStuffedOne Then
- SetFlags 0
- Exit Sub
- End If
- ' See if your text is already in the lisbox
- For I = 0 To KeyBuff.KeyBuffList.ListCount
- ' If so, get out gracefully
- If KeyBuff.KeyBuffList.List(I) = TextLine$ Then
- Exit Sub
- End If
- Next
- If KeyBuff.KeyBuffList.ListCount > MaxElements Then
- ' Remove one element
- KeyBuff.KeyBuffList.RemoveItem 0
- End If
- ' Add the item to the listbox
- KeyBuff.KeyBuffList.AddItem TextLine$
- ' Set the pointer
- KeyBuff.KeyBuffList.ListIndex = KeyBuff.KeyBuffList.ListCount - 1
- End If
-
- End Sub
-
- Sub MhKeyBuff ()
-
- ' When you Call this procedure
- ' the listbox becomes visible and
- ' the user can select a line of text
- ' that he wants plugged into the
- ' keyboard buffer.
- Dim ExitCode As Integer
-
- KeyBuff.ExitSignal.Text = "0" ' Exit code indicator
- ' 1 = Exit with paste
- ' 2 = Exit without paste
- KeyBuff.KickStart.Value = -1 ' Click the hidden button
- Do
- X% = DoEvents() ' Allow background processes
- ExitCode = Val(KeyBuff.ExitSignal.Text)
- Loop Until ExitCode
- KeyBuff.Hide
- If ExitCode = 1 Then
- SendKeys KeyBuff.KeyBuffList.List(KeyBuff.KeyBuffList.ListIndex)
- X% = DoEvents()
- End If
-
- End Sub
-
- Sub SetFlags (Condition%)
-
- JustStuffedOne = Condition%
-
- End Sub
-
- Sub MhClearKeyBuff ()
-
- Do While KeyBuff.KeyBuffList.ListCount
- KeyBuff.KeyBuffList.RemoveItem 0
- Loop
-
- End Sub
-
-