WordWeb Developer 3 User's Guide

1. Document Contents

Sections:
2. Product Overview
3. Product Contents
4. Developing Applications with WWDevCOM
5. WWDevCOM Interface Functions
6. Redistributing WWDevCOM with Your Application
7. Modifying WordWeb Developer Source Code
8. Links to More Information

Appendices:
A. WWDevCOM Constants
B. Code Samples
      Sample Setup Instructions
      1. Borland C++ Builder
      2. Borland Delphi
      3. Microsoft 2000/XP, Visual Basic 6
      4. Microsoft Visual Basic .NET
      5. Microsoft Visual Basic .NET - direct database access
      6. Microsoft Visual C# .NET
      7. Microsoft Visual C++ 6/.NET
      8. Microsoft Visual C++ 6/.Net - direct database access
C. Software License
D. Software Copyright and Disclaimer

This document was last updated February, 2005.

2. Product Overview

WordWeb Developer provides easy to use visual thesaurus/dictionary COM components, as well as allowing direct database access. The Source Code edition also includes full Delphi source code and native Delphi VCL components for powerful low level database access.

The WordWeb Developer COM interface is provided by WWDevCOM3.dll, a 32-bit in-process COM server that provides dictionary and thesaurus lookup services from any compiled or interpreted language that supports COM dual interfaces. This includes several popular development platforms, e.g. Borland Delphi, Borland C++ Builder, Microsoft Visual C++, Microsoft Visual Basic, and Microsoft Office products. Appendix B provides examples of how easy it is to use WordWeb Developer from each of these platforms.

WordWeb Developer provides programmatic access to two different dialogs from which the end-user may specify which related word or phrase best matches the word being looked up. Examples in Appendix B show how to display the dialogs using Borland C++ Builder and Borland Delphi.

Software developer can also access the database directly without using the user interface by specifing categories and relations from Appendix A.

The Delphi VCL source code (if purchased) can be compiled with Delphi 6 or higher (win32 only). The VCL components allow detailed low level access to database data. The source code for the visual WordWeb components is also included, and may serve as a useful source of example code.

3. Product Contents

The following files and folders are contained in WordWeb Developer folder.

Bin\

Wwedit.exe

- Dictionary viewing and customization program.

 

Wweb.ww3

- The WordWeb database file. Modifications to this file may be redistributed under a new filename as defined in Appendix C.

Demo\

WWDevCOMTest.exe

- Sample compiled test program using the COM components.

 

WWDevCOMTest.dpr

- Delphi project to compile the test program

 

MainWindow.pas

- Delphi source code (may find useful code samples here)

Docs\

Guide.html

- This user's guide document.

 

WWDevCOM3.idl

- Human-readable type library information.

Include\

WWDevCOM.h

- C++ / Delphi header file containing function interface constants found in Appendix A.

 

WWDevCOM_h.bas

- Office / Visual Basic header file containing function interface constants found in Appendix A.

 

WWDevCOM_h.cs

- Visual C# header file containing function interface constants found in Appendix A.

 

WWDevCOM_h.vb

- Visual Basic .NET header file containing function interface constants found in Appendix A.

 

WWDevCOM3.tlb

- Compiled COM server type library.

Redistrib\

WWDevCOM3.dll

- The COM DLL server.

Source\

WWDev\

- Delphi Pascal project folder containing dictionary and thesaurus VCL components (if source code was purchased). See ReadMe.txt for more information and Delphi installation instructions.

 

WWDevCOM\

- Delphi Pascal project folder containing COM server source code if purchased.

These files and folders are described in more detail below.

4. Developing Applications with WWDevCOM

To use the COM components with your development program you will need to install the type library. This is described at the start of the code samples section for various common programs.
Using a pop-up thesaurus dictionary
This is just a few lines of code. Just pen the database giving the the filename of the dictionary file, show the window, then close the database. In pseudo-code:
WWDevCOM.Open(in databasePath);
   // open a WordWeb-compatible database
wwDevCOM.ShowWordWeb(in lookupText,out outText,in Handle);
   // show the pop-up window
WWDevCOM.Close();
   // close the previously opened WordWeb-compatible database
The window is opened with the definition for lookupText displayed. If the user press the Copy button to close, outText contains the selected text, otherwise outText is empty. Handle is a handle of a parent window, and can just be zero. There are code samples in various real languages. See also the WWDevCOMTest project provided in the Demo folder of the distribution.

Accessing the database

WWDevCOM is the name of the COM object contained inside WWDevCOM3.dll. WWDevCOM supports the COM Single-Threaded Apartment model. The only unique restriction on concurrent usage is that a single WordWeb-compatible database may be opened by only one WWDevCOM object in one application at a time.

"IWWDev" is the only interface supported by WWDevCOM. This interface currently implements five functions: Open, Lookup, GetCount, GetRelated, and Close. This is the order that these functions will usually be invoked. The following pseudo-code demonstrates the general manner in which the WWDevCOM interface functions are used.

WWDevCOM.Open(in databasePath);
   // open a WordWeb-compatible database
WWDevCOM.Lookup(in lookupText, in wordType, in senseNumber, in tryDerived, in matchPart);

   // lookup a word or phrase

WWDevCOM.GetCount(in relation, out count);

   // determine number of related words/phrases or definition senses

for each index 0 to count - 1 do begin
   WWDevCOM.GetRelated(in relation, in index, out relatedText);
   // get a related word/phrase or definition sense

   //...do something with relatedText;
end;
WWDevCOM.Close();

   // close the previously opened WordWeb-compatible database

The current IWWDev interface functions are described in detail below in terms of their IDL (Interface Definition Language) definitions. See your development environment documentation for a description of IDL-specific terms. AddRelated and DeleteRelated are two additional functions that have been defined, but are not implemented in the current version of the server. Both of these unimplemented functions simply return E_NOTIMPL.

Included in Appendix B are code snippets that demonstrate proper usage of WWDevCOM from several development environments.

5. WWDevCOM Interface Functions

WWDevCOM.h is a C++/Pascal-compatible header file that defines constants that may be passed as parameters to the following functions. WWDevCOM3.bas is a Visual Basic-compatible module file that defines the same constants.

All function results are one of the following:

S_OK

- Returned if call is successful.

E_INVALIDARG

- Returned if an argument is invalid (e.g. out of range)

E_FAIL

- Returned for all other error conditions.

5.1 Open

Description:

This function opens a WordWeb-compatible database. It should be the first call made after creating a WWDev object. Once a database is opened, any number of calls to Lookup, GetCount, or GetRelated may be made prior to calling the Close function.

Declaration:

HRESULT _stdcall Open([in] BSTR databasePath );

Parameters:

databasePath

- Full path to a WordWeb-compatible database.

5.2 ShowWordWeb

Description:

Shows the WordWeb dictionary and thesaurus window, and allows the user to optionally chose a replacement word.

Declaration:

HRESULT _stdcall ShowWordWeb([in] BSTR inWord,[out] BSTR * ReplaceWord,[in] int AParent );

Parameters:

inWord

- The word to look up.

ReplaceWord

- A selected word if Copy is pressed; null if closed normally.

AParent

- Handle for the parent window. Can be zero.

5.3 ShowThesaurus

Description:

Shows a simple thesaurus window (no definitions), and allows the user to optionally chose a replacement word.

Declaration:

HRESULT _stdcall ShowThesaurus([in] BSTR inWord,[out] BSTR * ReplaceWord,[in] int AParent );

Parameters:

inWord

- The word to look up.

ReplaceWord

- A selected word if Copy is pressed; null if closed normally.

AParent

- Handle for the parent window. Can be zero.

5.3 Close

Description:

This function closes the previously opened WordWeb-compatible database. It should be the last call made prior to releasing a WWDev object. A database may be (re)opened once the current database is closed.

Declaration:

HRESULT _stdcall Close( void );

Parameters:

none

5.4 LookupWord

Description:

This function is used to lookup words and phrases without using a visual component. The results of the lookup are not returned by this function. The GetCount function must be called to determine how many related database or thesaurus entries exist for the lookup word or phrase, then the related entries may be retrieved by calling GetRelated for each entry.

Declaration:

HRESULT _stdcall Lookup([in] BSTR lookupText, [in] int wordType, [in] int senseNumber);

Parameters:

lookupText

- Word or phrase to look up in the dictionary/thesaurus.

wordType

- WWDAllWordTypes or any TwordType defined in Appendix A.

senseNumber

- WWDAllSenses or zero-based definition sense number. Total definition sense count is determined for a particular lookupText/wordType combination by calling GetCount, and passing WWDDefinition as the relation parameter.

5.5 GetCount

Description:

This function returns a count of all words/phrases or definition senses matching the lookup criteria.

Declaration:

HRESULT _stdcall GetCount([in] int relation, [out] int * count );

Parameters:

Relation

- May be any TsynType, TderivedForm, Root, Irregular TwordType, User Lookup, or Dictionary item defined in Appendix A. Note that sometimes irregular roots may be found in the dictionary/thesaurus even though no definition senses are found. This is a relatively rare occurrence.

count

- Total number of matches.

5.6 GetRelated

Description:

This function returns the specified related word/phrase or definition sense matching the lookup criteria. The GetCount function need not be called prior to the GetRelated function as long as a valid index is otherwise known and passed to the GetRelated function.

Declaration:

HRESULT _stdcall GetRelated([in] int relation, [in] int index, [out] BSTR * relatedText );

Parameters:

Relation

- May be any TsynType, TderivedForm, Root, Irregular TwordType, User Lookup, or Dictionary item defined in Appendix A.

Index

- Zero-based word/phrase or definition number.

RelatedText

- String containing related word/phrase or definition.

5.7 SetOptions

Description:

This function is used to set preferences for the behavior of the graphical components. Apart from English, showOptns: WWDOpts_TryDerived and showOpts:WWDOpts_MatchPart the settings only affect the WordWeb visual component. (If you need to have full programmatic access to usage tags use the full Delphi VCL component access rather than using the higher level COM components.)

Declaration:

HRESULT _stdcall SetOptions( [in] int English, [in] int showOpts, [in] int showLocales);

Parameters:

English

- One of the WWDEnglish_xxx constants specifying the English locale. WWDEnglish_Int gives language neutral behaviour.

showOpts

A sum of various display option constants:

  • WWDOpts_TryDerived - if a derived form is looked up, will attempt to find the root word; e.g. "houses" will look up "house"
  • WWDOpts_MatchPart - match the part of speech of related words to the lookup word
  • WWDOpts_HideVulgar - don't show vulgar related words
  • WWDOpts_HidePron - don't show pronunciations
  • WWDOpts_HideUsageExamples - don't show usage examples

showLocales

- Determines how WordWeb handles words from different English locales. Must be one of WWDLocales_HideOther, WWDLocales_FlagOther or WWDLocales_ShowOther.

6. Redistributing WWDevCOM with Your Application

WWDevCOM3.dll should be installed to the Windows\System folder (Windows 95, Windows 98 and Windows Me) or the Windows\System32 folder (Windows NT and Windows 2000/XP) on developer and end-user systems. Any previously existing version of the DLL should be replaced only if the version number of the file being installed is newer.

Regsvr32 may be used to automatically register the COM component contained inside the WWDevCOM server. Regsvr32.exe may be found in the Windows\System or Windows\System32 folder. WWDevCOM3.dll may be registered as follows:

                Regsvr32.exe /s WWDevCOM3.dll

WWDevCOM3.dll should not be unregistered or removed once it has been installed in order to avoid breaking other applications that use the DLL. File use counts may not be used to reliably determine if other applications are using the DLL.

Installation and registration of WWDevCOM3.dll requires local machine administrator privileges under Windows NT and Windows 2000/XP.

You may test your installation by looking up words using WWDevCOMTest.exe and the Wweb.ww3 database provided with WordWeb Developer.

7. Modifying WordWeb Developer Source Code

If you purchased a WordWeb Developer source code license, you received the full Delphi Pascal source code for WWDevCOM in the WWDevCOM folder and the WordWeb Developer dictionary and thesaurus components used by WWDevCOM in the WWDev folder. Follow the instructions contained in the WWDev/ReadMe.txt file to install the WordWeb components prior to building the WWDevCOM source code.

Since the WWDevCOM server is shared by potentially many applications, it is ABSOLUTELY IMPERATIVE that you take the following special precautions to avoid imposing your source code modifications on other applications.

The easiest and most reliable way to ensure that there are no conflicts with other applications is to copy the desired source code from the WWDevCOM project to another Delphi or Borland C++ source code project.

If you are copying the source code to another COM (EXE, DLL, or OCX) server, you must using "WWDevCOM" in the ProgID, CLSID, or server name. You may do so, by allowing the development environment to automatically create the skeleton source code for the COM object in your project, and making sure that you use some name other than WWDevCOM for the COM object and server names.

You are required to ensure that the included WWDevCOMTest.exe application still fully functions properly with WWDevCOM3.dll at the same time that your new component is in use, in order to demonstrate that your changes have not interfered with WWDevCOM.

WARNING: If you in any way deploy a conflicting component you are in violation of your source code license agreement and you relinquish all rights to use the source code in the conflicting component and future components.

8. Links to More Information

For information on updating WordWeb Developer, see the web pages at:

                 http://wordweb.info/developer/users.html

You may also be interested in WordWeb Pro, a program based on the TwordWeb component, but including a powerful pattern-matching word searching feature. It can also find multi-word anagrams. For more information please see:

                 http://wordweb.info/

Appendix A - WWDevCOM Constants

// TSynType
WWDSynonyms
WWDAntonyms
WWDAttributes
WWDCauses
WWDDerived
WWDEntails
WWDParts
WWDTypeOf
WWDTypes
WWDPartOf
WWDParticiple
WWDSeeAlso
WWDSimilar


= 0
= 1
= 2
= 3
= 4
= 5
= 6
= 7
= 8
= 9
= 10
= 11
= 12

// TDerivedForm
WWDPlural
WWDThirdPerson
WWDPast
WWDPastParticiple
WWDPresentParticiple
WWDComparitive
WWDSuperlative


= 13
= 14
= 15
= 16
= 17
= 18
= 19

// Root
WWDNounRoots
WWDVerbRoots
WWDAdjRoots


= 20
= 21
= 22

// Irregular TWordType
WWDIrregularNouns
WWDIrregularVerbs
WWDIrregularAdjs


= 23
= 24
= 25

// Dictionary
WWDClosestWords
WWDDefinition


= 28
= 29

// TWordType
WWDNoun
WWDVerb
WWDAdj
WWDAdv
WWDPreposition
WWDConjunction
WWDPronoun
WWDInterjection
WWDOtherType


= 0
= 1
= 2
= 3
= 4
= 5
= 6
= 7
= 8

// Language
WWDEnglish_Int
WWDEnglish_British
WWDEnglish_US
WWDEnglish_CA
WWDEnglish_UK
WWDEnglish_AU
WWDEnglish_IE
WWDEnglish_NZ
WWDEnglish_ZA
WWDEnglish_Asia


= 0
= 1
= 2
= 3
= 4
= 5
= 6
= 7
= 8
= 9

// Options
WWDOpts_HideVulgar
WWDOpts_TryDerived
WWDOpts_MatchPart
WWDOpts_HidePron
WWDOpts_HideUsageExamples


= 1
= 2
= 4
= 8
= 16

// Locale Options
WWDLocales_HideOther
WWDLocales_FlagOther
WWDLocales_ShowOther


= 1
= 2
= 3

// Misc
WWDFirstRelation
WWDLastRelation
WWDFirstWordType
WWDLastWordType
WWDAllWordTypes
WWDAllSenses


= 0
= 29
= 0
= 8
= -1
= -1

Appendix B - Code Samples

Sample Setup Instructions

Carefully follow the steps below for adding WordWeb Developer sample code to a new or existing project. Different instructions are provided for each supported development environment when needed.

See Redistributing WWDevCOM with Your Application for details on product installation. These samples all illustrate the proper usage of the WordWeb thesaurus / dictionary user interface component. The WordWeb simple thesaurus user interface component can also be used. Direct database access is also demonstrated, e.g. using WWDSynonyms (to silently determine synonymns) or WWDDefinition (to silently determine definition senses). See Developing Applications with WWDevCOM for a general overview of how to use WordWeb Developer to retrieve all manner of words, phrases, or definition senses related to the lookup word.

These samples have been tested with the versions of the supported development environments that are specified below, although WordWeb Developer should work with any environment that fully supports COM components.

A Delphi demo project is included in the Demo folder of the distribution, demonstrating use of the graphical components and direct database access.

Step 1. Import the WWDevCOM type library to the project.

WWDevCOM3.tlb is a type library file that your development environment may need in order to use the WWDevCOM Interface Functions. Your development environment may also be able to determine this information directly from WWDevCOM3.dll. The type library is a compiled version of the WWDevCOM3.idl file. WWDevCOM3.idl contains a human-readable description of the WWDevCOM interface that is written in IDL (Interface Definition Language). Neither the type library nor the IDL file should be installed on the end-user's computer system. Follow the instructions below to setup the type library file for use in your development environment.

Borland C++ Builder and Borland Delphi 6/7

Import the type library once per development environment by performing the following in order:


Then, add the WWDev component from the "Component Palette" to a dialog in each project that will use it.

Delphi 2005 works somewhat differently, and is not recommended due to numerous teething problems. For all versions make sure the .dcu output directory is not set - the WWDevCom3_TLB.dcu file must be compiled into the imports folder.

Microsoft Office 2000/XP/2003

a) From the Microsoft Office Visual Basic Editor, select "References..." from the "Tools" menu.
b) Click the "Browse" button from the "References" dialog.
c) From the "Add References" dialog, navigate to the "WWDevCOM3.tlb" file, and click the "Open" button.
d) From the "References" dialog, ensure that there is a check mark next to "WWDevCOM Library Version 3", and click the "OK" button.

Microsoft Visual Basic 6

a) Select "References..." from the "Project" menu.
b) Click the "Browse" button from the "References" dialog.
c) From the "Add References" dialog, navigate to the "WWDevCOM3.tlb" file, and click the "Open" button.
d) From the "References" dialog, ensure that there is a check mark next to "WWDevCOM Library Version 3", and click the "OK" button.

Microsoft Visual Basic .NET and Visual C# .NET

a) Select "Add Reference..." from the "Project" menu.
b) Click the "Browse" button from the "Add Reference" dialog.
c) From the "Select Component" dialog, navigate to the "WWDevCOM3.tlb" file, and click the "Open" button.
d) From the "Add Reference" dialog, ensure that the "WWDevCOM3.tlb" file is listed in the "Selected Components" list.

Microsoft Visual C++ 6 and Visual C++ .NET

Copy the "WWDevCOM3.tlb" type library file to the project folder.

Step 2. Add the appropriate WWDevCOM header file to the project.

A WWDevCOM header file is needed by your development environment in order to make the WWDevCOM Constants available for use in your program. The header file should not be installed on the end-user's computer system. Follow the instructions below to make a header file available to a program from your development environment.

Borland C++ Builder and Borland Delphi

Copy the "WWDevCOM.h" header file to the project folder.

Microsoft Office 2000/XP

a) From the Microsoft Office Visual Basic Editor, select "Import File..." from the "File" menu.
b) Navigate to the "WWDevCOM_h.bas" file, and click the "Open" button.

Microsoft Visual Basic 6

a) Select "Add Module" from the "Project" menu, and click the "Existing" tab on the "Add Module" dialog.
b) Navigate to the "WWDevCOM_h.bas" file, and click the "Open" button.

Microsoft Visual Basic .NET

a) Select "Add Existing Item..." from the "Project" menu, and select "All Files" in the "Files of type" dropdown on the "Add Existing Item" dialog.
b) Navigate to the "WWDevCOM_h.vb" file, and click the "Open" button.

Microsoft Visual C# .NET

a) Select "Add Existing Item..." from the "Project" menu, and select "All Files" in the "Files of type" dropdown on the "Add Existing Item" dialog.
b) Navigate to the "WWDevCOM_h.cs" file, and click the "Open" button.

Microsoft Visual C++ 6 and Visual C++ .NET

Copy the "WWDevCOM.h" header file to the project folder.

Step 3. Check location of the dictionary file.

Check the location of the database file "Wweb.ww3". The examples below assume this is in

c:\Program Files\Wordweb Developer 3\bin\Wweb.ww3.

Step 4. Add the sample code to the project.

Add the appropriate sample code below to the project, and ensure that the sample code is called from an appropriate point in the existing project code. Compile/build the project (if needed), run the project, and try out the sample code.

      1. Borland C++ Builder
      2. Borland Delphi
      3. Microsoft Office 2000/XP, Visual Basic 6
      4. Microsoft Visual Basic .NET
      5. Microsoft Visual Basic .NET - direct database access
      6. Microsoft Visual C# .NET
      7. Microsoft Visual C++ 6 and Visual C++ .NET
      8. Microsoft Visual C++ 6/C++ .NET - direct database access

1. Borland C++ Builder Sample

// Follow the Sample Setup Instructions in the WordWeb Developer
// User's Guide.
//
// This sample looks up the word 'text' in the WordWeb window.

// Include the WWDevCOM constant identifiers.
#include "WWDevCOM.h"

void WWDevCOMTest()
{
    TWWDev3 * wwDev;
    WideString outText;
    // Create a WWDevCOM object that must be manually released.
    wwDev = new TWWDev3(Application);

    // Open the database.
    wwDev->Open(WideString(L"c:\\program files\\wordweb developer 3\\bin\\Wweb.ww3"));

    // Look up the word "text" in the WordWeb window
    wwDev->ShowWordWeb(WideString(L"text"), &outText, 0);

    // Display the selected synonym
    MessageDlg(outText, mtInformation, TMsgDlgButtons() << mbOK, 0);

    // Close the database.
    wwDev->Close();

    // Free the WWDevCOM object.
    delete wwDev;
}

2. Borland Delphi Sample

// Follow the Sample Setup Instructions in the WordWeb Developer
// User's Guide.
//
// This sample looks up the word 'text' in the WordWeb window.

// Include the WWDevCOM constant identifiers.
{$INCLUDE 'WWDevCOM.h'}

procedure WWDevComTest()
var
    wwDev: TWWDev3;
    OutText: WideString;

begin
  // Create a WWDevCOM object that must be manually released.
    wwDev := TWWDev3.Create(Application);

    // Open the database.
    wwDev.Open('c:\program files\wordweb developer 3\bin\Wweb.ww3');

    wwDev.ShowWordWeb('text',OutText,0);
    
    if (OutText<>'') then Form1.Caption:=OutText;

    // Close the database.
    wwDev.Close;

    // Free the WWDevCOM object.
    wwDev.Destroy;

end;
For more complicated Delphi examples, including direct database access, see the sample code in the Demo folder.

3. Microsoft Office 2000/XP, Visual Basic 6 Sample

' Follow the Sample Setup Instructions in the WordWeb Developer
' User's Guide. Two lines of code need to be deleted in this
' sample and two lines need to be uncommented, depending on which
' development environment you are using.
'
' This sample uses the ShowWordWeb interface to allow the user
' to select a synonym and definition sense for the word 'text'.

Sub WWDevComTest()
     Dim wwd As WWDev3 
     Dim outText As String
  
    ' Create a WWDevCOM object that will be released when
    ' it goes out of scope.
     Set wwd = New WWDev3 
 
    ' Open the database (change to correct file location)
    Call wwd.Open("c:\program files\wordweb developer 3\bin\Wweb.ww3")
     
    ' Show the
    Call wwd.ShowWordWeb("text", outText, 0)

    ' Display the selected synonym if Copy button pressed
    If outText <> "" Then MsgBox (outText)

    ' Close the database.
    Call wwd.Close
End Sub

4. Microsoft Visual Basic .NET Sample

' Follow the Sample Setup Instructions in the WordWeb Developer
' User's Guide. Two lines of code need to be deleted in this
' sample and two lines need to be uncommented, depending on which
' development environment you are using.
'
' This sample uses the ShowWordWeb interface to allow the user
' to select a synonym and definition sense for the word 'text'.

Sub WWDevComTest()
    Dim wwd As WWDevCOM3.WWDev3 
    Dim outText As String
  
    ' Create a WWDevCOM object that will be released when
    ' it goes out of scope.
     wwd = New WWDevCOM3.WWDev3()

    ' Open the database (change to correct file location)
    Call wwd.Open("c:\program files\wordweb developer 3\bin\Wweb.ww3") 
     
    ' Show the
    Call wwd.ShowWordWeb("text", outText, 0)

    ' Display the selected synonym if Copy button pressed
    If outText <> "" Then MsgBox (outText)

    ' Close the database.
    Call wwd.Close
End Sub

5. Microsoft Visual Basic .NET - direct database access

' Follow the Sample Setup Instructions in the WordWeb Developer
' User's Guide. 
'
' This sample performs a silent database lookup and displays
' words related to the lookup text, organized by word type and
' definition. The output is similar to what is displayed by
' the ShowWordWeb user interface.

Sub WWDWordWebSimulation()

        Dim count As Integer
        Dim definition As Integer
        Dim definitionCount As Integer
        Dim index As Integer
        Dim irregular As Integer
        Dim lookupText As String = "swimming"
        Dim relatedText As String
        Dim relation As Integer
        Dim relationLabel() As String = {"Synonyms", "Antonyms", "Attribs", "Causes", _
            "Derived", "Entails", "Parts", "Type of", "Types", "Part of", "Participle", _
            "See also", "Similar"}
        Dim root As Integer
        Dim rootText As String
        Dim str As String
        Dim wordType As Integer
        Dim wordTypeLabel() As String = {"Noun: ", "Verb: ", "Adjective: ", "Adverb: ", _
            "Preposition: ", "Conjunction: ", "Pronoun: ", "Interjection: ", "Other: "}
        Dim wwd As WWDevCOM3.WWDev3

        ' Create a WWDevCOM object that will be released when it goes out of scope.
        wwd = New WWDevCOM3.WWDev3

        ' Open the database.
        Call wwd.Open("c:\program files\wordweb developer 3\bin\Wweb.ww3")

        ' Display the lookup text
        str = "Lookup: " + lookupText + Chr(13) + Chr(13)

        ' For each possible word type...
        For wordType = WWDevCOM_h.WWDNoun To WWDevCOM_h.WWDInterjection
            ' Narrow lookup to the word type form of the lookup text.
            Call wwd.LookupWord(lookupText, wordType, WWDevCOM_h.WWDAllSenses)

            ' Determine if definition senses exist for this word type.
            Call wwd.GetCount(WWDevCOM_h.WWDDefinition, definitionCount)

            ' If definition senses for this word type form exist then...
            If definitionCount > 0 Then
                ' Begin the word type display header line.

                ' Display the word type label.
                str = str + wordTypeLabel(wordType)

                ' Determine the root form of the lookup text.
                rootText = lookupText

                ' If a root form of the lookup text might exist then...
                If wordType <= WWDevCOM_h.WWDAdj Then
                    ' Determine if a root form exists.
                    root = WWDevCOM_h.WWDNounRoots + (wordType - WWDNoun)
                    Call wwd.GetCount(root, count)

                    ' If a root form exists then get it.
                    If count = 1 Then
                        Call wwd.GetRelated(root, 0, rootText)
                    End If

                End If ' a root form of the lookup text might exist.

                ' Display the root text.
                str = str + rootText

                ' If irregular forms of the root text might exist then...
                If wordType <= WWDevCOM_h.WWDAdj Then
                    ' Lookup the root text
                    Call wwd.Lookup(rootText, wordType, WWDevCOM_h.WWDAllSenses, True, False)

                    ' Determine if irregular forms exist.
                    irregular = WWDevCOM_h.WWDIrregularNouns + (wordType - WWDNoun)
                    Call wwd.GetCount(irregular, count)

                    ' If irregular forms of the root text exist then display them.
                    If count > 0 Then
                        ' Begin irregular form display.
                        str = str + " ("

                        ' For each irregular form...
                        For index = 0 To count - 1
                            ' Get the irregular form.
                            Call wwd.GetRelated(irregular, index, relatedText)

                            ' Display the irregular form.
                            str = str + relatedText

                            If index < count - 1 Then
                                str = str + ","
                            End If

                        Next ' Irregular form

                        ' End irregular form display.
                        str = str + ")"
                    End If ' irregular forms of the root text exist

                End If ' irregular forms of the root text might exist.

                ' End the word type display header line.
                str = str + Chr(13)

                ' For each definition sense of the word type form of the lookup text...
                For definition = 0 To definitionCount - 1
                    ' Narrow the lookup to (other) words related to this definition sense.
                    Call wwd.Lookup(lookupText, wordType, definition, True, False)

                    ' Display the definition sense.
                    Call wwd.GetRelated(WWDevCOM_h.WWDDefinition, definition, relatedText)
                    str = str + Space(4) + Format(definition + 1) + ". " + relatedText + Chr(13)

                    ' For each way that a word may be related...
                    For relation = WWDevCOM_h.WWDSynonyms To WWDevCOM_h.WWDSimilar
                        Call wwd.GetCount(relation, count)

                        ' If there are related words...
                        If count > 0 Then
                            ' Display the relation header label.
                            str = str + Space(8) + relationLabel(relation) + ": "

                            ' For each related word...
                            For index = 0 To count - 1
                                ' Get the related word.
                                Call wwd.GetRelated(relation, index, relatedText)

                                ' Display the related word.
                                str = str + relatedText

                                If index < count - 1 Then
                                    str = str + ", "
                                Else
                                    str = str + Chr(13)
                                End If

                            Next ' related word.

                        End If ' there are related words.

                    Next ' way that a word may be related.

                Next ' definition sense of the word type form of the lookup text.

            End If ' definition senses for this word type form exist.

        Next ' word type.

        ' Display the WordWeb simulated output.
        MsgBox(str, MsgBoxStyle.OKOnly, "")

        ' Close the database.
        Call wwd.Close()
End Sub ' WWDWordWebSimulation

6. Microsoft Visual C# .NET Sample

// Follow the Sample Setup Instructions in the WordWeb Developer
// User's Guide.
//
// This sample uses the ShowWordWeb interface to allow the user
// to select a synonym and definition sense for the word 'text'.

private void WWDevCOMTest()
{ WWDevCOM3.IWWDev3 wwDev; string outText; // Create a WWDevCOM object that must be manually released. wwDev = new WWDevCOM3.WWDev3Class(); // Open the database. wwDev.Open("c:\\program files\\wordweb developer 3\\bin\\Wweb.ww3"); // Lookup all noun, verb, adjective, etc. synonyms for the // word 'text'. wwDev.ShowWordWeb("text",out outText,0); //Show replacement word if Copy button was pressed if (outText != "") System.Windows.Forms.MessageBox.Show(this, outText); wwDev.Close(); }

5. Microsoft Visual C++ 6/.Net Sample

// Follow the Sample Setup Instructions in the WordWeb Developer
// User's Guide. Note that WordWeb Developer does not require MFC
// support when used with Visual C++, although this sample uses
// it for convenience.
//
// This sample uses the WWDWordWeb interface to allow the user
// to select a synonym and definition sense for the word 'text'.

// Import the WWDevCOM type library information.
#import "wwdevcom3.tlb"

// Include the WWDevCOM constant identifiers.
#include "WWDevCOM.h"

void WWDevComTest()
{
  WWDevCOM3::IWWDev3Ptr wwDev;
    BSTR outText;
    CString str;

    // Initialize COM if needed.
    //CoInitialize(NULL);

    // Create a WWDevCOM object that must be manually released.
    wwDev.CreateInstance(__uuidof(WWDevCOM3::WWDev3));

    // Open the database.
    wwDev->Open(L"c:\\program files\\wordweb developer 3\\bin\\Wweb.ww3");

    // Lookup all noun, verb, adjective, etc. synonyms for the
    // word 'text'. 
    wwDev->ShowWordWeb("text", &outText, 0);
    str = outText;

    SysFreeString(outText);

    // If Copy pressed, show replacement word
    if (str != "") AfxMessageBox(str);

    // Close the database.
    wwDev->Close();

    // Free the WWDevCOM object.
    wwDev.Release();
}

6. Microsoft Visual C++ 6/.Net Sample - direct database access


// Follow the Sample Setup Instructions in the WordWeb Developer
// User's Guide. Note that WordWeb Developer does not require MFC
// support when used with Visual C++, although this sample uses
// it for convenience.
//
// This sample silently finds all synonyms for a given word

// Import the WWDevCOM type library information.
#import "wwdevcom3.tlb"

// Include the WWDevCOM constant identifiers.
#include "WWDevCOM.h"

void WWDevComTest()
{
    WWDevCOM3::IWWDev3Ptr wwDev;
    BSTR outText;
    CString str, showStr;
    short count;

    //Initialize COM if required.
    //CoInitialize(NULL);

    // Create a WWDevCOM object that must be manually released.
    wwDev.CreateInstance(__uuidof(WWDevCOM3::WWDev3));

    // Open the database.
    wwDev->Open(L"c:\\program files\\wordweb developer 3\\bin\\Wweb.ww3");

    // Lookup all noun, verb, adjective, etc. synonyms for the
    // word 'text'. Try derived word types, but don't go out
    // of the way to match the part of speech.
    wwDev->LookupWord("text", WWDAllWordTypes, WWDAllSenses);

   //Find how many synonyms are in the database.
    wwDev->GetCount(WWDSynonyms, &count);

    showStr = "";
    //Get all the synonyms   
    for (int index = 0; index < count; ++index) {

            // Get each related item.
            wwDev->GetRelated(WWDSynonyms, index, &outText);
            str = outText;
            // Free the system allocated string.
            SysFreeString(outText);

            // Add the related item to the buffer.
            if (index != 0) {showStr = showStr + ", ";}

            showStr = showStr + str;

    } // end for

    // Show the string of synonyms
    if (str != "") AfxMessageBox("Synonyms: " + showStr);

    // Close the database.
    wwDev->Close();

    // Free the WWDevCOM object.
    wwDev.Release();

}

Appendix C - Software License

Purchase of WordWeb Developer grants a non-transferable non-exclusive license as follows:

  1. You may use only one copy of the software on a single computer. You may use the software on a different computer only if you first delete all files installed by the setup program from the first computer.
  2. You may freely distribute compiled programs using any of the WordWeb Developer code subject to the following conditions:
    a. The copyright text in the source code may not be modified or deleted.
    b. Your program or DLL is not competitive with WordWeb, WordWeb Pro or Crossword Compiler. Your program may not be marketed as a thesaurus, dictionary, thesaurus/dictionary, crossword solver or crossword compiler. Your program must be substantially more than a wrapper around WordWeb Developer code.
    c. Source code derived from the WWDevCOM server source code must comply with the restrictions described in
    Section 7.
  3. You may freely distribute the Wweb.ww3 database file, or similar database files created by the dictionary customization program. However if you distribute a customized database its file name may not begin with the letters "wweb". If you generate a database file yourself that is not compatible with the default format it may not be distributed with an extension starting "ww". You may not distribute the data file with any program or DLL that is competitive with WordWeb, WordWeb Pro, WordWeb Online, WordWeb Developer or Crossword Compiler.
  4. You may not distribute the whole, or any portion of the source code. The same goes for the dictionary customization program.

Appendix D - Software Copyright and Disclaimer

WordWeb Developer 3 Copyright © 2005 by Antony Lewis. All rights reserved.

WordNet 2.0 Copyright © 2003 by Princeton University. All rights reserved.

THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.