Click here to Skip to main content
13,202,155 members (73,314 online)
Click here to Skip to main content


107 bookmarked
Posted 6 Jan 2001

A Spell Checking Engine

, 5 Feb 2001
A free spell checking engine for use in your C++ applications. Includes the current US English dictionary
#if !defined(AFX_DLGSPELLCHECKER_H__B58E6D0E_FB89_4E48_9080_16A951BB4939__INCLUDED_)
#define AFX_DLGSPELLCHECKER_H__B58E6D0E_FB89_4E48_9080_16A951BB4939__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgSpellChecker.h : header file

class CFPSSpellCheckEngine;

typedef struct CDlgSpellChecker_CHANGEALLTAG
	CString strBad;
	CString strGood;
} CDlgSpellChecker_CHANGEALL;

// CDlgSpellChecker dialog

class CDlgSpellChecker : public CDialog
// Construction
	CDlgSpellChecker(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	enum { IDD = IDD_SPELL_CHECK };
	CListBox	m_lstSuggestions;
	CEdit	m_editSentence;

	CEdit*	m_pEdit;
	CRichEditCtrl* m_pRichEdit;
	CFPSSpellCheckEngine* m_pEngine;

// Overrides
	// ClassWizard generated virtual function overrides
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation
	virtual void ChangeCancelToClose();
	virtual CDlgSpellChecker_CHANGEALL* FindChangeAll(LPCSTR lpszBad);
	virtual void SaveSentence();
	virtual void AddChangeAll(LPCSTR lpszBad, LPCSTR lpszGood);
	virtual void ContinueChecking(int iPos);
	virtual void FindSuggestions();
	virtual BOOL CheckSentence(CString& strSentence, int iStartAt = 0);
	virtual BOOL GetSentence(int iSentence, int& iBeginsAt, CString& strSentence);
	virtual BOOL GetNextSentence();
	virtual void BeginSpellCheck();

	// Generated message map functions
	afx_msg void OnAdd();
	afx_msg void OnAutoCorrect();
	afx_msg void OnCancel();
	afx_msg void OnChange();
	afx_msg void OnChangeAll();
	afx_msg void OnIgnore();
	afx_msg void OnIgnoreAll();
	afx_msg void OnOptions();
	afx_msg void OnUndo();
	afx_msg void OnDblclkSuggestions();
	virtual BOOL OnInitDialog();
	afx_msg void OnChangeSentence();

	int m_iSentence;
	int m_iSentenceBegin;
	int m_iSentenceLen;
	int m_iWordBegin;
	CString m_strMisSpelledWord;
	CString m_strOutWord;

	CTypedPtrList<CPtrList, CDlgSpellChecker_CHANGEALL*> m_ChangeAll;

void CheckSpellingEdit (CFPSSpellCheckEngine* pEngine, CEdit* pEdit);
void CheckSpellingRich (CFPSSpellCheckEngine* pEngine, CRichEditCtrl* pEdit);

// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DLGSPELLCHECKER_H__B58E6D0E_FB89_4E48_9080_16A951BB4939__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Matt Gullett
Web Developer
United States United States
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.171020.1 | Last Updated 6 Feb 2001
Article Copyright 2001 by Matt Gullett
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid