Frequently Asked Support Questions


Add button disabled in spelling dialog

Problem: The Add button is disabled in the spelling dialog, so words cannot be added to a user dictionary.

Solution: The Add button is enabled only if a user dictionary is available to which words can be added. If no user dictionary files are available, then the Add button will be disabled. If user dictionary files are listed in the UserDictionaryFiles property but can't be opened for some reason (e.g., the files do not exist in the same directory as wspell.ocx or their paths are incorrect), the Add button will be disabled.

Most or all words reported as misspellings

Problem: When checking text, Spellex ActiveX reports all or most words as misspellings.

Solution: The main American and UK English dictionaries are shipped as two files: SSCEAM.TLX (or SSCEBR.TLX) and SSCEAM2.CLX (or SSCEBR2.CLX). The first file contains about 1,000 of the most commonly used words in English. The second file contains about 100,000 of the most commonly used words. Words in the first file are also present in the second file.

If Spellex ActiveX accepts words such as "the" or "of" but doesn't accept words such as "engine" or "improvement", the most likely cause is failure to open the SSCEAM2.CLX (or SSCEBR2.CLX) file. If Spellex ActiveX rejects all words including words such as "the" and "of", the most likely cause is failure to open any dictionary files. The following points may help you to track down the problem:

  • Spellex ActiveX's MainDictionaryFiles property must be set to the list of files forming the main dictionary. By default, MainDictionaryFiles is set to "ssceam.tlx,ssceam2.clx".

  • The files listed in the MainDictionaryFiles property must be separated with a comma. No spaces should follow the commas.

  • If the file names in MainDictionaryFiles contain no paths, then the corresponding files must be located in the same directory as WSPELL.OCX.

  • If the dictionary files reside in a different directory than WSPELL.OCX, then the file names listed in MainDictionaryFiles must contain full paths. For example, "c:\myapp\dicts\ssceam.tlx,c:\myapp\dicts\ssceam2.clx".

  • After setting the MainDictionaryFiles property or after calling the AddMainDictionaryMethod, the MainDictionaryFiles property will contain only the dictionary files which could be opened. If MainDictionaryFiles is empty, then none of the dictionary files could be opened.

  • If Spellex ActiveX cannot open a dictionary file, then the ErrorCode property will contain a code which explains the reason. See "Error Codes" in the Constants section of the Spellex ActiveX programmer's guide for an explanation of each code.

Misspelled words not detected

Problem: Spellex ActiveX does not report certain words as misspelled, even when you know them to be misspelled. This happens when you call the Start method after setting the Text or TextControlHWnd properties, or when you call the TestWord method.

Causes: This problem can be caused by various conditions:

  • If the unreported words are capitalized, make sure the IgnoreCapitalizedWords property is set to False. When this property is True, Spellex ActiveX automatically skips over capitalized words (e.g., Spellex) without checking them, so they will not be reported as misspellings. Similarly, if the words are in all-caps (e.g., SPELLEX), make sure the IgnoreAllCapsWords property is set to False, and if they contain mixed upper and lower case (e.g., SpelLex) make sure the IgnoreMixedDigits property is set to False. (Alternatively, you can leave these options enabled, but be aware that they may cause misspelled words to be missed.)

  • Unless you are checking German or Finnish text using the German or Finnish dictionary, make sure the SplitWords property is set to False. If this option is enabled, Spellex ActiveX will consider a word valid if it consists of two or more valid sub-words concatenated (e.g., winterhamster).

  • Make sure you have main dictionary files in only one language open. For example, don't open the American English and French dictionaries at the same time in the same instance of the Spellex ActiveX control. If dictionaries for more than one language are open, misspelled words in one language that happen to match words in the other language will not be reported as misspellings.

Using multilingual dictionaries

Question: How can I set up my application so it uses the Dutch, French, German, etc. dictionaries instead of English?

Answer: If you distribute any European-language dictionaries with your application, you should install them on your customers' systems in the directory where WSPELL.OCX is installed. Spellex's dictionary files follow a common naming standard; see "About Spellex ActiveX's Dictionaries" in the Spellex ActiveX Programmer's Guide for details. Your application can determine which dictionaries are installed by looking for the associated file names.

If you use the French or Italian dictionaries, your application should set the SplitContractedWords property to True.

If you use the German or Finnish dictionaries, your application should set the SplitWords property to True.

Solving performance problems

Problem: When checking spelling or looking up suggestions, Spellex ActiveX seems to take longer than expected.

Solution: The usual cause is setting the CaseSensitive property to False. Spellex ActiveX's dictionaries are optimized for case-sensitive access. When case-sensitivity is disabled, Spellex ActiveX sometimes has to search for a word several times (e.g., search for the capitalized form, uncapitalized form, etc.). This can result in reduced performance. Other causes of poor performance are system related: excessive swapping or background activity, slow disk drives, etc. The first time Spellex ActiveX is accessed, it opens dictionaries and performs various housekeeping tasks that make take a second or two to complete.

Failure to register WSPELL.OCX

When an ActiveX (OCX) control such as Spellex ActiveX is installed on a target machine, it must be registered (for example, using regsvr32). Under some circumstances, registration may fail. Note that this problem is not specific to Spellex ActiveX; it can apply to the registration of any OCX. According to Microsoft, registration failure is caused by two conditions on the target system: 1) Missing or out of date DLLs; 2) problems with the system registry.

The list of DLLs used by Spellex ActiveX (and the DLLs those DLLs use, etc.) is provided below. If you are experiencing problems registering Spellex ActiveX on a target machine, check that the system in question has the listed DLLs available, that the DLLs are located in the search path (e.g., in the WINDOWS or WINDOWS\SYSTEM directory), and that the versions are equal to or later than the versions listed here:

  • mfc42.dll (version 6.0.8168.0)

  • msvcrt.dll (version 6.0.8168.0)

  • olepro32.dll (5.0.4261.0) 

Files mfc42.dll and msvcrt.dll are distributed with Spellex ActiveX and are installed in the WINDOWS\SYSTEM directory when the Spellex ActiveX software development kit is installed on the development machine. To obtain the other files, go to http://support.microsoft.com/support and search for Vbrun60.exe from the downloadable files. The mfc42.dll and olepro32.dll files have the OleSelfRegister attribute, which means they should be registered. If you copy these files onto the target system, have your installer register them, or run regsvr32 on them. For more information on regsvr32, see MSKB article Q146219.

Another cause of registration failure is errors in the system registry. Microsoft has made a utility called RegClean available which solves the problem and allows OCX controls (such as Spellex ActiveX) to be registered successfully. RegClean is described in MSKB article Q147769. According to the MSKB article, the latest version of RegClean should be used, not the version shipped with Visual Basic. The article describes how to obtain the latest version of RegClean.

Spellex ActiveX behaves like evaluation version

Problem: I had tried the Spellex ActiveX evaluation version, then I purchased the retail version of Spellex ActiveX. It still behaves like the evaluation version: the "evaluation version" message pops up each time I try to check spelling.

Discussion: Spellex ActiveX is a licensed ActiveX control. Spellex ActiveX uses licensing information to determine whether it is an evaluation version or commercial version. Spellex ActiveX obtains this licensing information from a disk file on your development computer. When you use Spellex ActiveX in an ActiveX control container such as Visual Basic or VC++, the control container asks Spellex ActiveX for a copy of its licensing information. The control container stores the licensing information somewhere, and gives it to Spellex ActiveX at run time for validation. When you use the evaluation version of Spellex ActiveX, the evaluation license information is stored by the control container. If you later purchase the retail version of Spellex ActiveX, sometimes the control container continues to use the evaluation license information, causing Spellex ActiveX to think it is still an evaluation version. (This licensing protocol was designed by Microsoft; it is common to all licensed ActiveX controls, not just Spellex ActiveX.)

Solutions:

  • Re-compile your application. Some control containers (e.g., Visual Basic) store the license information in the application's .EXE file. When you compile the application or make the .EXE file again, the current licensing information will be stored in the .EXE file.

  • If you are using Spellex ActiveX with Microsoft Visual C++, you may need to remove Spellex ActiveX from the VC++ gallery then re-add it. When you add a licensed ActiveX control (such as Spellex ActiveX) to the VC++ gallery, VC++ reads the control's licensing information. When you add the control to a project, VC++ places the licensing information in the project's .rc file. VC++ doesn't automatically change the licensing information in the .rc even if the .lic file changes. Because you tried the evaluation version of Spellex ActiveX, VC++ stored the evaluation licensing information in your project's .rc file. Even though you now have the retail version of Spellex ActiveX, the evaluation licensing information is still in your .rc file, so Spellex ActiveX behaves as though it were still under evaluation. The solution is to remove Spellex ActiveX from your project and from the VC++ component gallery, then re-add it to the gallery and to your project. VC++ will read the new licensing information and store that in the .rc file.

  • You may need to remove Spellex ActiveX from your development environment, then re-add it. How this is done depends on the specific programming language and development environment. Removing the control, then re-adding it, will sometimes cause the development environment to re-read the licensing information. You may need to contact the manufacturer of your programming language/compiler/development environment for specific instructions.

  • If you moved wspell.ocx to a different directory in your development environment, it won't be able to find its licensing information. Spellex ActiveX expects to find its licensing information in the same directory as wspell.ocx. This problem can also occur if you have two or more copies of wspell.ocx on your system.

  • Some control containers do not support the ActiveX licensing protocol. If you are very knowledgeable about ActiveX and COM, you can implement the protocol yourself. Otherwise, you might want to use the Spellex Sentry Spelling Checker Engine instead, which is a DLL and does not use the licensing protocol. Contact Spellex Software Sales for details.

Spellex ActiveX doesn't work with PowerBuilder, Access, or Delphi

Problem: I can't get Spellex ActiveX to work with my PowerBuilder, MS Access, or Delphi application.

Solution: PowerBuilder does not work correctly with licensed ActiveX controls such as Spellex ActiveX, so we cannot support its use.

Spellex ActiveX does not currently work with Microsoft Access, and some problems have been reported with certain versions of Dephi.

We recommend using our Spellex Windows SDK product for use with PowerBuilder, Access, or Delphi.

Using Spellex ActiveX in a non-dialog container in MFC

Problem: I'm trying to use Spellex ActiveX in my MFC application, but I don't want to add Spellex ActiveX to a dialog. How do I do this?

Solution: When you use an ActiveX control this way, your application is behaving like an ActiveX control container, so it must support the ActiveX licensing protocol. In general, the container asks the control for a copy of its licensing information at "design time" and holds on to this information internally. At run time, the container passes the licensing information to the control for verification.

When you add a control to the VC++ gallery, VC++ gets the control's licensing information. When you add the control to a project, VC++ puts the licensing information in the resource script. Your application can read the licensing information from the resource at run time and pass that to Spellex ActiveX when it creates the control object. We have been unable to locate any information on the details of doing this in Microsoft's VC++ documentation or knowledge base.

Using our Spellex Windows SDK product in this case would be simpler. SSCE comes with an MFC class that makes integration with MFC applications in non-dialog situations simpler than using Spellex ActiveX.

"Error replacing word (probably out of space)" error message

Problem: When checking text using the TextControlHWnd property or with the ShowContext property set to True, the message "Error replacing word (probably out of space)" appears when the user clicks the Change button in the spelling dialog.

Solution: Standard text boxes in Windows can hold about 32K of text. If this limit is reached, any attempt to add characters to the text box will fail. The error message is displayed if an attempt to add characters to a text box fails. When the ShowContext property is True, the spelling dialog displays the text being checked in a text box which has the same 32K limit.

If you are using the TextControlHWnd property, the solution is to use a rich-text box instead of a text box. Rich-text boxes have a limit of about 16Mb. If you are using the ShowContext property, break the text into smaller chunks that will fit into the 32K limit with room for expansion.

Window contents not updated when ShowContext is True

Problem: The contents of the window referenced by the TextControlHWnd property are not updated when the ShowContext property is set to True.

Solution: This behavior is by design. When ShowContext is True, the context window is the window that is updated during checking. Spellex ActiveX will update either the context window or the window referenced by the TextControlHWnd property, but not both. If you need to update both, you can catch Spellex ActiveX events and highlight and replace words as described in the Spellex ActiveX Programmer's Guide under "How to highlight misspelled words" and "How to update the checked document."

Using user dictionaries from Word (and other applications)

Question: Your documentation says I can use Word's dictionaries, but a) I don't know how or b) when I try, it doesn't work.

Answer: The first thing to note is that we claim Spellex ActiveX works with other applications' user dictionaries. We have been very careful to always qualify "dictionary" with "user" when describing Spellex ActiveX's capabilities in our Web pages and programmer's guide. Spellex ActiveX cannot use Word's (or any other application's) main dictionary for technical and legal reasons.

The user dictionary is typically a small text file containing words the user added, such as the user's family name, street name, business name, etc. In Microsoft Word, the user dictionary is often called custom.dic. To find the names of the user dictionaries Word knows about, select (in Word) Tools + Options + Spelling & Grammar, then click on the Dictionaries... button. The dialog that pops up shows the path to the user dictionaries plus a list of user dictionary files. Knowing the path name and the user dictionary file name, you can add the user dictionary to the UserDictionaryFiles property.

Problems with using Spellex ActiveX on Web pages

This section describes some of the things you can try when you have problems getting Spellex ActiveX to work in a Web page displayed using Internet Explorer.

Getting ActiveX controls to work in Internet Explorer is definitely non-trivial. Internet Explorer is very "fussy" about how things are set up, and if anything goes wrong, it generally displays the same message: "Object does not support this property or method." As far as we can tell, this message means IE was unable to create an instance of the control, so any attempt to refer to it in a script won't work. Unfortunately, a large number of problems can prevent IE from creating an instance of the control.

Here are some ideas, things to try, and general information that may be of use if you run into problems:

  • Start with one of the examples in Spellex ActiveX's ie\examples folder. These examples have been tested and are known to work.

  • Starting with version 5.13, you must create an LPK file containing your Spellex ActiveX license. The LPK file shipped with Spellex ActiveX contains an expired evaluation license.

  • Make sure you have added an "LPK" file to your Web page containing Spellex ActiveX's licensing information. LPK files are created using LPK_Tool, which is available from Microsoft. Spellex ActiveX is a licensed ActiveX control. A "license manager" object must be embedded in the HTML page before any controls that require licensing are embedded. The license manager has no visible representation on the page and refers to the LPK file through a PARAM attribute on its <OBJECT> tag:
    <OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331"> <PARAM NAME="LPKPath" VALUE="thispage.LPK"> </OBJECT>

For more information on using licensed ActiveX controls, see MSKB article Q159923.

  • Make sure the clsid of the license manager is correct (the clsid listed above is correct). Make sure the LPK file is in the same directory as the Web page, or that you use a correct path in the VALUE= parameter. Make sure the license manager object is declared correctly (no typos). Make sure only one reference to the license manager object is defined on the page.

  • The CAB files shipped with the Spellex ActiveX SDK (in the ie\examples folder) direct IE to install Spellex ActiveX in the System32 directory on the client machine. Look for wspell.ocx in the System32 directory. If it's not there, then most likely IE could not find, access, or download the wspell.cab file from your server. If it is there, then the most likely cause of the problem has to do with licensing, which might mean IE couldn't find, access, or download the .lpk file, the .lpk file's contents were invalid, or the .lpk file does not contain a valid Spellex ActiveX license.

  • You can test your .lpk file by opening one of the example .html files in Spellex ActiveX's ie\examples folder directly using your browser. The examples refer to wspell.lpk, so your .lpk file must be named wspell.lpk and must exist in the ie\examples folder. If the examples work, your .lpk file is OK.

  • If you code your scripts using JScript rather than VBScript, note that JScript is case-sensitive while VBScript is not.

  • In some cases Internet Explorer writes an error log to the Temporary Internet Files directory. This file is a text file that may contain diagnostic information that might help you to solve the problem. The file will have a name like this:

    ?CodeDownloadErrorLog!name={ACEFFC26-4628-11D1-B14A-105C01C13001}

  • (the part after the "name=" is Spellex ActiveX's clsid).

  • If you test an HTML file containing wspell.cab on the same system that the Spellex ActiveX SDK is installed on, IE will use the registered instance of wspell.ocx. It won't download or install wspell.cab. You can un-register wspell.ocx using regsvr32. For example, if your copy of the Spellex ActiveX SDK was installed in c:\Program Files\Spellex ActiveX, un-register wspell.ocx like this:
  • regsvr32 /u "c:\Program Files\Spellex ActiveX\wspell.ocx"
    (Earlier versions of the SDK installed and registered wspell.ocx in the "System" or "System32" directory.)

  • While you are attempting to solve problems, do the following after making a change to force IE to re-download files:

  • Delete IE's temporary Internet files. Select "Internet Options" from IE's Tools menu, then click the "Delete Files" button on the General tab.

  • Un-register and remove wspell.ocx from the System32 directory. To un-register wspell.ocx, use regsvr32 /u as described above.

Security Warnings and Errors

Problem: Internet Explorer displays a security warning or error when you attempt to use Spellex ActiveX on a Web page.

Following are some points that may help:

  • If you install Spellex ActiveX from a CAB file, make sure the CAB file contains an .INF file which directs the installation of Spellex ActiveX on the client computer.

  • Make sure the CAB file is digitally signed. A CAB file containing the American English dictionary, digitally signed by Spellex Corporation, is available for downloading. If you want to include other dictionaries, you will have to create the CAB file and sign it using your own certificate.

  • Try lowering the browser's security level, or adjusting the security options.

Incorrect event firing

If your application catches MisspelledWord, WordWithDigits, MixedCaseWord, Capitalization, or ConditionallyChangeWord events, it should not call the Resume method from the event handler. Calling the Resume method from the event handler for one of these events may cause spurious events to occur or may cause events to be fired in the wrong order (e.g., a MisspelledWord event may be fired after an EndOfText event).

The Spellex ActiveX programmer's guide (version 5.8 and earlier) in the section titled "How to check spelling" states that the Resume method should be called to continue checking. However, the following clarifications must be made:

  1. The Resume method should not be called from within the event handler for the reasons noted above.

  2. If the ShowDialog property is true, the Resume method should not be called. Once the Start method has been called, the built-in spell check dialog will take over and will continue running until all words have been checked or the user presses the Cancel button on the dialog.

If your application needs to catch one of the above-named events and does not use the built-in spell check dialog (i.e., sets the ShowDialog property to False), then it should call the Resume method in a loop which terminates when the EndOfText event is fired. The following code fragments show how this is done:

Private Sub SpellCheckButton_Click() Dim rslt As Integer ' Check the context of TextBox1 ' endOfTextFired is a global Boolean variable WSpell1.Text = TextBox1.Text endOfTextFired = False rslt = WSpell1.Start While (Not endOfTextFired And rslt >= 0) rslt = WSpell1.Resume Wend End Sub Private Sub WSpell1_EndOfText() endOfTextFired = True End Sub

Removing words from the main dictionary

Question: How can I delete certain words from the main dictionary? I don't want these words to be offered as suggestions, and I want them to be treated as misspellings.

Answer: You can effectively eliminate specific words by adding them to a user dictionary with the wSpellExcludeAction. Any words marked with the wSpellExcludeAction will not be offered as suggestions, and they will be reported as misspellings during spell checking. The user dictionary containing the excluded words must be opened before other dictionaries containing the words. One way to achieve this is to set the dictionary containing the excluded words as the first dictionary in the MainDictionaryFiles list. For example, if you have added the excluded words to a dictionary called excluded.tlx, you might set MainDictionaryFiles to

excluded.tlx,ssceam.tlx,ssceam2.clx

You can use the CreateUserDictionary method to create the dictionary, and the AddToUserDictionary method to add words to it with the wSpellExcludeAction.

Misspelled words not highlighted in text box being checked

Problem: When you check the contents of a text box (edit control) using the TextControlHWnd property, misspelled words are not highlighted.

Solution: Make sure the text box has the Hide Selection property set to False. If you create the control yourself, make sure the ES_NOHIDESEL edit style is set. See "How to highlight misspelled words" in the "Using Spellex ActiveX" chapter of the Spellex ActiveX Programmer's Guide for more information.

Using Spellex ActiveX with a third-party edit control

Problem: When you set Spellex ActiveX's TextControlHWnd property to the handle of a third-party text control, nothing happens, or the results aren't as you expect.

Discussion: Spellex ActiveX communicates with the control being checked through standard messages such as WM_GETTEXTLENGTH and WM_GETTEXT. This technique works with standard text and rich-text boxes. Unfortunately, many third-party controls do not respond to these messages, or they respond in non-standard ways.

Solution: The solution is to add code in your application to "bridge the gap" between Spellex ActiveX and the third-party control. An example of this technique can be found in the "Local Dialog" demo included with the Spellex ActiveX example programs (e.g., see the "spellex activex\vb\examples" directory). The Local Dialog demo uses a regular edit control (text box), but the technique applies to most third-party controls as well.

The technique works as follows

  1. Extract plain, unformatted text from the control into a string, then set Spellex ActiveX's Text property to the value of the String.

  2. Set Spellex ActiveX's ShowDialog property to True, and set the ShowContext property to False. This causes Spellex ActiveX to display its built-in dialog box to interact with the user to dispose of spelling errors. (The Local Dialog demo does not use the built-in dialog, but rather a dialog implemented in the example application. Either approach can be used with this technique.)

  3. Call Spellex ActiveX's Start method.

  4. Catch the MisspelledWord, DeleteWord, WordWithDigits, MixedCaseWord, Capitalization, and ConditionallyChangeWord events. See "How to highlight misspelled words" in the "Using Spellex ActiveX" chapter of the Spellex ActiveX Programmer's Guide for instructions on what to do when these events are caught.

  5. Catch the ReplaceWord and DeleteWord events. See "How to update the checked document" in the "Using Spellex ActiveX" chapter of the Spellex ActiveX Programmer's Guide for instructions on what to do when these events are caught.

Sharing dictionaries across a network

Question: Is it possible to place dictionary files on a common network file server so they can shared by all users?

Answer: Yes. Just specify the full path to the dictionary file in the MainDictionaryFiles property:

MainDictionaryFiles="g:\dict\ssceam.tlx,g:\dict\ssceam2.clx"      

or

MainDictionaryFiles="\\SERVER\\dict\ssceam.tlx,\\SERVER\\dict\ssceam2.clx"      

We do not recommend sharing editable user dictionaries, however. If all users share an updateable dictionary, one user can compromise the effectiveness of the spell checker for all users by adding a misspelled word. We recommend that each user have his or her own user dictionaries. If you want to have a common dictionary containing site-specific words, add it to MainDictionaryFiles like this:

MainDictionaryFiles="ssceam.tlx,ssceam2.clx,g:\dict\ourwords.tlx

and have an administrator carefully update it as needed.

License Problems

Problem 1: When you attempt to use Spellex ActiveX is Visual Basic (or another development environment), an error message similar to "License information for this component could not be found" is displayed.

Solutions:

Try re-installing Spellex ActiveX, taking care to enter the license key provided by Spellex Corporation when prompted by the setup program. Note that the license key is not the same as the serial number.

Spellex ActiveX expects to find its design-time license information in a file located in the same directory as wspell.ocx. If wspell.ocx is moved and re-registered, or if a different copy of wspell.ocx is registered on the system (as can happen if an application which uses Spellex ActiveX is installed), the design-time license file will no longer be where it is expected and the licensing error will occur. The solution is to run regsvr32 to re-register the development copy of wspell.ocx like this:

regsvr32 \Program Files\Spellex ActiveX\wspell.ocx

If you are using a version of Spellex ActiveX prior to 5.14 on Windows 2000 or XP, the problem may be caused by another copy of Spellex ActiveX in use by an application you installed on your development system. The only solutions are to uninstall the other application or to use Spellex ActiveX version 5.14 or later.

Problem 2: You can use Spellex ActiveX in your development environment, but it does not work when you install it with your application on a target system, or works only if wspell.lic (which is not redistributable) is also installed.

Discussion:

Spellex ActiveX uses the ActiveX licensing protocol. The protocol consists of two parts: the control portion, which Spellex ActiveX implements, and the container portion, which your application implements. When you use Spellex ActiveX in a Visual Basic application, for example, VB asks Spellex ActiveX for its licensing information at design time, and stores that information in the application's EXE file. At run time, VB provides the licensing information to Spellex ActiveX, allowing it to run. VB takes care of the container side of the licensing protocol when you use a licensed ActiveX control in an application.

Not all programming languages implement the container portion of the licensing protocol. In these situations, you must implement the container portion of the protocol in your application, or Spellex ActiveX will not work. Even if the programming language normally implements the container portion of the protocol in applications, there may be other situations where it does not. For example, if you use Spellex ActiveX inside an ActiveX control created in Visual Basic, VB will not implement the container side of the protocol and you must do it explicitly. The same holds true for MFC applications which use ActiveX controls in non-dialog containers; see Using Spellex ActiveX in a non-dialog container in MFC for further information.

You should note that the licensing protocol is part of the ActiveX technology, not something specific to Spellex ActiveX. Many (but not all)ActiveX controls use this licensing technology.

For more information on the ActiveX licensing protocol, search for "ActiveX licensing" on MSDN.

If implementing the container portion of the licensing protocol seems like too much effort, you might consider using our Spellex Windows Spelling Engine and SDK product instead. The Spellex Windows SDK engine is implemented as a straightforward Win32 DLL.

Problems with locating suggestions

Problems:

  • No suggestions are given by the Suggest method or displayed in the spelling dialog when a misspelled word is detected.
  • The correct spelling does not appear in the list of suggestions.

A number of factors affect the success of Spellex ActiveX's suggestion feature, and it can be difficult to determine in advance what conditions are most likely to yield success. Some of the factors that influence the suggestion feature are listed below.

  • SuggestionDepth property: The value of the SuggestionDepth property is an integer ranging from 0 to 100. The value determines the tradeoff between time to locate suggestions and the quality of the suggestions produced. A value of 100 produces the best (most accurate) suggestions but takes the most time. Unfortunately, the factors listed below affect the depth needed to locate the best suggestion. For some misspellings, the correct suggestion will be located at depth 10 and for others depth 100 is needed. The built-in spelling dialog box uses an interesting approach to deal with this. Initially, the suggestion list in the spelling dialog box is populated using the depth indicated by the MinSuggestDepth property, which is typically fairly low (e.g., 30). This produces suggestions quickly, and, in many cases, produces the correct suggestion. The spelling dialog boxes contain a "Suggest" button. When this button is pressed, the suggestion depth value is increased by the value of the SuggestionDepthIncrement property, and a new set of suggestions is obtained. The user can repeatedly press the Suggest button to obtain suggestions at increasingly higher depths (until the maximum depth, 100, is reached, at which point the Suggest button is disabled).
  • Word length: Locating suggestions is pattern matching. Short words have less information available to ensure a successful match. Furthermore, the small number of letters means less letter diversity, which essentially means that short words tend to look more alike than do longer words, decreasing the probability that the correct match can be made.
  • Number of errors: The more incorrect letters a word has, the less it looks like the correct word and the more it may look like other words.
  • Position of errors: When errors occur near the beginning of a word, a higher suggestion depth may be needed to locate the correct spelling.
  • Similarity to other words: Words that have letters in common with many other words may result in so many suggestions of equal value that the correct spelling is discarded. This can happen because Spellex ActiveX locates the best set of suggestions. The size of the set is determined by the MaxSuggestions property. For example, if MaxSuggestions is set to 16, but 17 words are found that make equally good replacements for the misspelled word, it's possible that the word left out will be the correct word.
  • Algorithm: The phonetic suggestion algorithm has a better chance of finding the correct spelling for badly misspelled words (e.g., where half of the letters are incorrect). However, the phonetic algorithm is sometimes confused by certain combinations of letters. Better results may be achieved by using both the phonetic and typographical algorithms (with some increase in the time required to locate suggestions). If neither suggestion algorithm is selected, then no suggestions will be produced.<

Explanation of MixedDigits and MixedCase properties

This topic contains an explanation of how the IgnoreMixedCaseWords, IgnoreWordsWithDigits, CatchMixedCaseWords, and CatchWordsWithDigits properties operate.

When Spellex ActiveX engine checks spelling, it performs the following steps for each word:

  1. It determines if the word matches the criteria for any enabled Ignore properties, and if so, it skips the word and proceeds to the next word without performing the next step.

  2. It determines if the word matches the criteria for any enabled Catch properties, and if so, it reports the word by raising an event such as MisspelledWordEvent, MixedCaseWord, or WordWithDigits.

The two steps above are performed in the order listed. Thus, a word that has been ignored is essentially filtered out, so no further tests (including spelling) are performed on it. For this reason, enabling both properties IgnoreMixedCaseWords and CatchMixedCaseWords is pointless. A word containing mixed case will be filtered out (because IgnoreMixedCaseWords is enabled), and will therefore never be reported as containing mixed case. "Ignore" properties take precedence over similarly named "Catch" properties.

The tests performed in Step 2 above are independent of each other. The tests for doubled words, mixed-case words, or words containing digits can all be enabled and disabled independently by enabling and disabling the corresponding Catch properties. All tests indicated by any enabled Catch properties are carried out, even if one or more of the other tests proves positive. Thus, Spellex ActiveX may detect several conditions (problems) with a single word: The word may be misspelled, doubled, contain mixed case, and contain mixed digits all at once. Several events may be fired for the same word.

The presence of a word in a dictionary affects only its spelling. If a word exists in a dictionary with the default "Ignore", Spellex ActiveX will not report it as misspelled. However, if the word matches the criteria for a test indicated by one of the enabled Catch properties, the word will still be reported even if it exists in a dictionary. For example, assume the CatchMixedCaseWords property is True, and that the word "PrintScreen" does not exist in any open dictionary. Spellex ActiveX will fire both the MisspelledWordEvent and MixedCaseWord events for "PrintScreen". If "PrintScreen" is then added to an open dictionary, Spellex ActiveX will still fire the MixedCaseWord event when it encounters "PrintScreen". Adding the word to a dictionary does not change the fact that it contains mixed case, and because CatchMixedCaseWords is enabled, Spellex ActiveX will still report to your application that the word contains mixed case.

The same situation exists when "Ignore All" is selected as the disposition for a reported word. Selecting "Ignore All" for a reported word adds the word to a temporary internal dictionary, which prevents it from being reported as misspelled (i.e., prevents Spellex ActiveX from firing the MisspelledWordEvent event for the word). However, as we have seen, adding a word to a dictionary (including a temporary dictionary) does not alter the fact that the word contains mixed case, so selecting "Ignore All" does not prevent Spellex ActiveX from subsequently firing the MixedCaseWord event for that word.

Note that all of the above is true for the CatchWordsWithDigits property as well, when a word contains embedded digits, such as "Win2000".

You might consider not enabling the CatchMixedCaseWords or CatchWordsWithDigits properties. As stated above, these properties cause Spellex ActiveX to perform separate, special tests against each word, and to report the results of those tests through events. But unless you have some specific need to know if a word contains mixed case or embedded digits, the tests may be superfluous. Even if these two Catch properties are disabled, words such as "PrintScreen" or "Win2000" will still be reported as misspelled if they are not contained within an open dictionary. Presumably if they are contained in a dictionary, the intention is that they are correct and should not be reported for any reason. Case errors such as "TUesday" and missing-space errors such as "June5" will still be reported as misspellings (unless "TUesday" and "June5" happen to exist in an open dictionary).

Using Spellex ActiveX with TX Text Control

Applies to: Spellex ActiveX Version 5.14 and earlier

Spellex ActiveX's TextControlHWnd feature works directly with text and rich-text controls which are part of the Windows standard controls (i.e., which are part of the Windows operating system). TX Text Control from The Imaging Source Europe does not fall into this category, so it will not work with the TextControlHWnd feature. However, it is still possible to use Spellex ActiveX to check the text contained by TX Text Control, as this topic explains.

Two approaches can be used, depending on the needs of your application.

Approach 1: Using Spellex ActiveX's built-in Spelling dialog box

If you want to use Spellex ActiveX's built-in spelling dialog box to interact with the user to dispose of spelling errors, follow this approach.

The approach is based on the "Check 3rd Party" demo in the Spellex ActiveX examples. This demo provides a technique for checking the spelling of text contained by third-party text controls using Spellex ActiveX. The technique involves obtaining the unformatted text from the control via its Text property, submitting that text to Spellex ActiveX's Text property, then responding to events fired by Spellex ActiveX to highlight misspelled words in the text control, replace misspelled words, etc. Usually, words are highlighted in the text control by selecting them, using the text control's SelStart and SelLength properties (or equivalent). Words in the text control are replaced by selecting them (using SelStart and SelLength), then replacing the selected text with the correct word.

This approach will in fact work with TX Text Control as is, with one minor exception: additional steps need to be taken to preserve the formatting of the word when a misspelled word is replaced. This is done in the event handler for Spellex ActiveX's ReplaceWord event. The modified approach for TX Text Control does the following: 1) Select the word starting at its second letter to the end of the word; 2) Replace the selected text with the correct word; 3) Delete the first letter of the original word by selecting just that letter and replacing it with an empty string. Here is some Visual Basic code to accomplish these steps:

Private Sub WSpell1_ReplaceWord()
Dim Start As Long
Start = WSpell1.WordOffset

' Replace the misspelt word. Keep first character to preserve formatting
TextControl.SelStart = WSpell1.WordOffset + 1
TextControl.SelLength = Len(WSpell1.MisspelledWord) - 1
TextControl.SelText = WSpell1.ReplacementWord

' Now delete first character
TextControl.SelStart = Start
TextControl.SelLength = 1
TextControl.SelText = ""
End Sub

Approach 2: Using a custom spelling dialog box

If you want to use a custom spelling dialog box to interact with the user to dispose of spelling errors, follow this approach.

The approach is based on the "Custom dialog box" demo in the Spellex ActiveX examples. This demo shows how to check the spelling of text contained by a text control, and interact with the user via a dialog box of your own design and implementation. The demo is coded to work with standard edit controls/text boxes, but it can easily be modified to work with TX Text Control.

The Start method in SpellingDialogForm accepts as a parameter a reference to the TextBox object which is to be spell-checked. Modify the Start method to accept a TX Text Control object:

Public Function Start(theTextBox As TXTextControl) As Boolean
The Start method saves a private reference to the text control being spell-checked. Modify the declaration of this private reference as follows:
' Text box to check
Private checkTextBox As TXTextControl
When a misspelled word is replaced in a TX Text Control, additional steps need to be taken to preserve the formatting of the word. This is done in the event handler for Spellex ActiveX's ReplaceWord event. The modified approach for TX Text Control does the following: 1) Select the word starting at its second letter to the end of the word; 2) Replace the selected text with the correct word; 3) Delete the first letter of the original word by selecting just that letter and replacing it with an empty string. Here is some Visual Basic code to accomplish these steps:

Private Sub WSpell1_ReplaceWord()
Dim Start As Long
Start = WSpell1.WordOffset

' Replace the misspelt word. Keep first character to preserve formatting
TextControl.SelStart = WSpell1.WordOffset + 1
TextControl.SelLength = Len(WSpell1.MisspelledWord) - 1
TextControl.SelText = WSpell1.ReplacementWord

' Now delete first character
TextControl.SelStart = Start
TextControl.SelLength = 1
TextControl.SelText = ""
End Sub

Tips and hints

  • If the ShowDialog property is True, the built-in spell check dialog appears briefly when the Start method is called even if there is no text to check or the text contains no misspelled words. If you want to prevent the dialog from appearing, first determine if the text contains any misspelled words: Set ShowDialog to False, catch the EndOfText event, then call the Start method. If the EndOfText event was fired, then the text contains no misspelled words so there's no need to continue. If the EndOfText event is not fired, then the text contains at least one misspelled word, or a word with some other problem (e.g., doubled word, embedded digits, etc.). Set ShowDialog to True, set the Text or TextControlHWnd properties again to reset Spellex ActiveX, then call the Start method. Here is some sample code that demonstrates this approach:
Dim eot As Boolean
eot = False

WSpell1.Text = textbox1.Text
WSpell1.ShowDialog = False
WSpell1.Start

If (Not eot) Then
' At least one problem was detected
WSpell1.Text = textbox1.Text
WSpell1.ShowDialog = True
WSpell1.Start
End If

Private Sub WSpell1_EndOfText()
eot = True
End Sub
  • If you want to check text in two or more languages, don't open dictionaries for both languages at the same time. Having dictionaries for two languages open at once increases the probability that a misspelled word in one language will match a valid word in the other language, and therefore will not be detected. Also, having two main dictionaries open at once will increase the time required to check spelling and look up suggestions. Instead, use two (or more) instances of the Spellex ActiveX control, and open the dictionary for one language in each instance. At run time, use the appropriate Spellex ActiveX instance to check text based on the text's language

Home | Order Now | Products | Upgrades | Free Trial | Partners | About Spellex | Contact Us | Site Map | Privacy Policy

Spellex Corporation © 2012. All rights reserved