home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
csapi
/
spell.frm
< prev
next >
Wrap
Text File
|
1993-11-03
|
10KB
|
309 lines
VERSION 2.00
Begin Form frmSpellCheckerAPI
Caption = "Spell Checker API"
ClientHeight = 6810
ClientLeft = 765
ClientTop = 375
ClientWidth = 7950
Height = 7215
Left = 705
LinkTopic = "Form1"
ScaleHeight = 6810
ScaleWidth = 7950
Top = 30
Width = 8070
Begin Frame frmSpellOption
Caption = "SpellOption"
Height = 1080
Left = 135
TabIndex = 20
Top = 3030
Width = 7620
Begin CheckBox chkSpellOption
Caption = "FindUncappedSentences"
Enabled = 0 'False
Height = 255
Index = 1
Left = 345
TabIndex = 19
Tag = "&h10"
Top = 360
Width = 2475
End
Begin CheckBox chkSpellOption
Caption = "FindRepeatWords"
Enabled = 0 'False
Height = 255
Index = 0
Left = 345
TabIndex = 18
Tag = "&h40"
Top = 615
Width = 1905
End
End
Begin Frame frmSpellTerminate
Height = 705
Left = 135
TabIndex = 16
Top = 5685
Width = 7620
Begin CommandButton cmdSpellTerminate
Caption = "SpellTerminate"
Height = 270
Left = 75
TabIndex = 17
Top = 285
Width = 2010
End
Begin Label lblSpellTerminate
BorderStyle = 1 'Fixed Single
Height = 240
Left = 2145
TabIndex = 14
Top = 300
Width = 5310
End
End
Begin Frame frmSpellCheck
Height = 1530
Left = 135
TabIndex = 12
Top = 4080
Width = 7620
Begin TextBox tbxSpellCheck
Height = 1155
HideSelection = 0 'False
Left = 2145
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 15
Text = "Now is the the tieme for all goood men. so there."
Top = 285
Width = 5310
End
Begin CommandButton cmdSpellCheck
Caption = "SpellCheck"
Enabled = 0 'False
Height = 270
Left = 75
TabIndex = 13
Top = 285
Width = 2010
End
End
Begin Frame frmSpellVerifyMdr
Height = 705
Left = 135
TabIndex = 9
Top = 795
Width = 7620
Begin CommandButton cmdSpellVerifyMdr
Caption = "SpellVerifyMdr"
Height = 270
Left = 90
TabIndex = 10
Top = 285
Width = 2010
End
Begin Label lblSpellVerifyMdr
BorderStyle = 1 'Fixed Single
Height = 240
Left = 2145
TabIndex = 11
Top = 300
Width = 5310
End
End
Begin Frame frmSpellOpenMdr
Height = 705
Left = 135
TabIndex = 6
Top = 2265
Width = 7620
Begin CommandButton cmdSpellOpenMdr
Caption = "SpellOpenMdr"
Enabled = 0 'False
Height = 270
Left = 75
TabIndex = 7
Top = 285
Width = 2010
End
Begin Label lblSpellOpenMdr
BorderStyle = 1 'Fixed Single
Height = 240
Left = 2145
TabIndex = 8
Top = 300
Width = 5310
End
End
Begin Frame frmSpellInit
Height = 705
Left = 135
TabIndex = 3
Top = 1485
Width = 7620
Begin CommandButton cmdSpellInit
Caption = "SpellInit"
Height = 270
Left = 60
TabIndex = 4
Top = 285
Width = 2010
End
Begin Label lblSpellInit
BorderStyle = 1 'Fixed Single
Height = 240
Left = 2145
TabIndex = 5
Top = 300
Width = 5310
End
End
Begin Frame frmSpellVer
Height = 705
Left = 135
TabIndex = 1
Top = 45
Width = 7620
Begin CommandButton cmdSpellVer
Caption = "SpellVer"
Height = 270
Left = 90
TabIndex = 2
Top = 285
Width = 2010
End
Begin Label lblSpellVer
BorderStyle = 1 'Fixed Single
Height = 240
Left = 2145
TabIndex = 0
Top = 300
Width = 5310
End
End
End
Sub chkSpellOption_Click (Index As Integer)
For i% = 0 To 1
If chkSpellOption(i%).Value Then spellOption& = spellOption& Or Val(chkSpellOption(i%).Tag)
Next
rci% = SpellOptions(csSpellIdentifier, spellOption&)
End Sub
Sub cmdReset_Click ()
tbxSpellCheck.Text = "Now is the the tieme for all goood men. so there."
End Sub
Sub cmdSpellCheck_Click ()
holdTextBuffer$ = tbxSpellCheck.Text
csTextBuffer = tbxSpellCheck.Text
Me.Enabled = False
Load frmSpellChecker
Do
de% = DoEvents()
If tbxSpellCheck.Text <> csTextBuffer Then tbxSpellCheck.Text = csTextBuffer
If csReturnStatus = scrsUnknownInputWord Or csReturnStatus = scrsRepeatWord Or csReturnStatus = scrsNoSentenceStartCap Then
tbxSpellCheck.SelStart = csUnknownWordStart - 1
tbxSpellCheck.SelLength = csUnknownWordLength
csReturnStatus = 99
End If
Loop Until csReturnStatus = csCancel Or csReturnStatus = csDone Or csReturnStatus = csError
tbxSpellCheck.SelStart = 0
tbxSpellCheck.SelLength = 0
Me.Enabled = True
Unload frmSpellChecker
Select Case csReturnStatus
Case csCancel
tbxSpellCheck.Text = holdTextBuffer$
rci% = MsgBox("The spelling check was cancelled.", 48, "Spell Checker")
Case csError
rci% = MsgBox("A more informative error message is needed here.", 64, "Spell Checker")
Case Else
tbxSpellCheck.Text = csTextBuffer
rci% = MsgBox("The spelling check is complete.", 64, "Spell Checker")
End Select
End Sub
Sub cmdSpellInit_Click ()
If SpellerInit(errorCode%) Then
lblSpellInit.Caption = "Error: " & errorCode%
Else
lblSpellInit.Caption = "Spell Id: " & csSpellIdentifier
cmdSpellInit.Enabled = False
cmdSpellOpenMdr.Enabled = True
For i% = 0 To 1
chkSpellOption(i%).Enabled = True
Next
End If
End Sub
Sub cmdSpellOpenMdr_Click ()
If SpellerOpenMdr(majorError%, minorError%) Then
lblSpellOpenMdr.Caption = "Error: Major-" & majorError% & " Minor-" & minorError%
Else
lblSpellOpenMdr.Caption = "Mdr= " & csMainDictionaryReference.Mdr & "; Lid= " & Hex$(csMainDictionaryReference.Lid) & "h; Udr= " & csMainDictionaryReference.Udr
cmdSpellOpenMdr.Enabled = False
cmdSpellCheck.Enabled = True
End If
End Sub
Sub cmdSpellTerminate_Click ()
If Not SpellerTerminate(errorCode%, True) Then
csSpellIdentifier = 0
cmdSpellInit.Enabled = True
lblSpellInit.Caption = ""
cmdSpellOpenMdr.Enabled = False
lblSpellOpenMdr.Caption = ""
cmdSpellCheck.Enabled = False
tbxSpellCheck.Text = "Now is the the tieme for all goood men. so there."
For i% = 0 To 1
chkSpellOption(i%).Enabled = False
chkSpellOption(i%).Value = False
Next
End If
End Sub
Sub cmdSpellVer_Click ()
lblSpellVer = SpellerVersion()
End Sub
Sub cmdSpellVerifyMdr_Click ()
lblSpellVerifyMdr.Caption = SpellerVerifyMdr()
End Sub
Sub Form_Load ()
csMainDictionary$ = "c:\windows\msapps\proof\mssp_am.lex"
csUserDictionary$ = ""
End Sub
Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
If csSpellIdentifier Then rci% = SpellTerminate(csSpellIdentifier, True)
End Sub