Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HWND from a VFP EditBox?
Message
 
To
04/09/2000 18:27:44
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00412205
Message ID:
00412684
Views:
24
>>Plus I wasn't all that happy with htis spell checking control anyway.
>
>Hehe, you'll proably laugh your head off, but I just put this in one of our internal apps to spell check an edit box:
>
>StrToFile(this.parent.edtText.value, 'spllchecker.txt')
>modi file spllchecker.txt nowait
>do (_spellchk)
>release windows 'spllchecker.txt'
>this.parent.edtText.Value = FileToStr('spllchecker.txt')

>
>By the way, SpllCheck.App is probably not distributable, right? Anyone know?

It isn't. Also if I remember right the dictionary was really bad on it...


I used Word to do basically the same thing but interactively. It's pretty cool actually the way this turned out, but since I needed this to be modal it was somewhat hard to do. I ended up with an always on top form. FWIW, here's the code for that form:

You pass it as an input a textbox or editbox control reference:

*** Only allow one instance
DO FORM Spell with THISFORM.txtBody NAME oSpell Linked




**************************************************
*-- Form: frmspellcheck (d:\wwapps\wwhelp\spell.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 09/04/00 12:07:04 AM
*
DEFINE CLASS frmspellcheck AS form


Height = 43
Width = 401
ShowWindow = 2
DoCreate = .T.
AutoCenter = .T.
Caption = "Help Builder Word Spell Check"
Closable = .F.
HalfHeightCaption = .T.
MaxButton = .F.
MinButton = .F.
Icon = "bmps\wrench.ico"
WindowType = 1
WindowState = 0
AlwaysOnTop = .T.
oword = .NULL.
lcancelled = .F.
Name = "frmSpellCheck"
oeditbox = .F.


ADD OBJECT label1 AS label WITH ;
FontName = "Tahoma", ;
FontSize = 8, ;
WordWrap = .T., ;
Caption = "Use Word's underscore spell checking (red squiggles) or run the full Spell Checker (F7). When done click OK to update Help Topic text or Cancel to abort changes.", ;
Height = 51, ;
Left = 3, ;
Top = 3, ;
Width = 261, ;
Name = "Label1"


ADD OBJECT cmdok AS commandbutton WITH ;
Top = 5, ;
Left = 276, ;
Height = 23, ;
Width = 61, ;
FontName = "Tahoma", ;
FontSize = 8, ;
Caption = "\ Name = "cmdOK"


ADD OBJECT cmdcancel AS commandbutton WITH ;
Top = 5, ;
Left = 338, ;
Height = 23, ;
Width = 61, ;
FontName = "Tahoma", ;
FontSize = 8, ;
Caption = "\ Name = "cmdCancel"


PROCEDURE Init
LPARAMETERS oEditBox

*** Reuse Word reference because of Word Unload bug
IF VARTYPE(goSpellCheck) = "O"
THIS.oWord=goSpellCheck
ELSE
IF !ISCOMOBJECT("Word.Application")
MESSAGEBOX("Sorry, you need to have MS Word in order to use this features.",48,"Help Builder")
RETURN .F.
ENDIF
THIS.oWord=CREATEOBJECT("Word.Application")
PUBLIC goSpellCheck
goSpellCheck = THIS.oWord
ENDIF

loWord = THIS.oWord
loWord.VISIBLE = .T.

loDoc = THIS.oWord.Documents.ADD()
loDoc.Content = oEditBox.VALUE

THISFORM.oEditBox = oEditBox
ENDPROC


PROCEDURE Destroy
*** Doesn't work reliably due to Word unload issues
ENDPROC


PROCEDURE cmdok.Click
IF TYPE("THISFORM.oword.ActiveDocument") = "O"
THISFORM.oEditBox.value = THISFORM.oWord.ActiveDocument.Content.Text
THISFORM.oword.ActiveDocument.Close(.F.)
ENDIF

THISFORM.oword.visible = .F.

*THISFORM.oword = .F.

RELEASE THISFORM
ENDPROC


PROCEDURE cmdcancel.Click
THISFORM.lCancelled = .T.

IF TYPE("THISFORM.oword.ActiveDocument") = "O"
THISFORM.oword.ActiveDocument.Close(.F.)
ENDIF
THISFORM.oword.visible = .F.
THISFORM.oWord.Quit
THISFORM.oword = .NULL.

RELEASE THISFORM
ENDPROC


ENDDEFINE
*
*-- EndDefine: frmspellcheck
**************************************************
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform