ispellcheck.h
来自「管理项目进度工具的原代码」· C头文件 代码 · 共 111 行
H
111 行
// ISpellChecker.h: interface for the ISpellChecker class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ISPELLCHECK_H__7741547B_BA15_4851_A41B_2B4EC1DC12D5__INCLUDED_)
#define AFX_ISPELLCHECK_H__7741547B_BA15_4851_A41B_2B4EC1DC12D5__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#pragma warning(disable:4189)
#pragma warning(disable:4127)
#include <Windows.h>
// function to be exported from dll to create instance of interface
#ifdef _EXPORTING // declare this in project settings for dll _only_
# define DLL_DECLSPEC __declspec(dllexport)
#else
# define DLL_DECLSPEC __declspec(dllimport)
#endif
#define ISPELLCHECK_VERSION 0x0000
class ISpellChecker;
typedef ISpellChecker* (*PFNCREATE)(const char*, const char*); // function prototype
extern "C" DLL_DECLSPEC ISpellChecker* CreateSpellCheckerInterface(const char* szAffPath, const char* szDicPath); // single exported function
typedef int (*PFNGETVERSION)(); // function prototype
extern "C" DLL_DECLSPEC int GetInterfaceVersion();
#pragma warning(disable:4505)
// helper method
static ISpellChecker* CreateSpellCheckerInterface(const char* szDllPath, const char* szAffPath, const char* szDicPath)
{
ISpellChecker* pInterface = NULL;
HMODULE hDll = LoadLibrary(szDllPath);
if (hDll)
{
PFNCREATE pCreate = (PFNCREATE)GetProcAddress(hDll, "CreateSpellCheckerInterface");
if (pCreate)
{
// check version
PFNGETVERSION pVersion = (PFNGETVERSION)GetProcAddress(hDll, "GetInterfaceVersion");
if (!ISPELLCHECK_VERSION || (pVersion && pVersion() >= ISPELLCHECK_VERSION))
pInterface = pCreate(szAffPath, szDicPath);
}
}
return pInterface;
}
static BOOL IsSpellCheckDll(const char* szDllPath)
{
HMODULE hDll = LoadLibrary(szDllPath);
if (hDll)
{
PFNCREATE pCreate = (PFNCREATE)GetProcAddress(hDll, "CreateSpellCheckerInterface");
FreeLibrary(hDll);
return (NULL != pCreate);
}
return FALSE;
}
class ISpellChecker
{
public:
virtual void Release() = 0; // releases the interface
//
virtual bool CheckSpelling(const char* szWord) = 0;
virtual bool CheckSpelling(const char* szWord, char**& pSuggestions, int& nNumSuggestions) = 0;
// frees a previously returned buffer and sets the ptr to NULL
virtual void FreeSuggestions(char**& pSuggestions) = 0;
};
static void ReleaseSpellCheckerInterface(ISpellChecker*& pInterface)
{
if (pInterface)
{
pInterface->Release();
pInterface = NULL;
}
}
class ISpellCheck
{
public:
virtual const char* GetFirstWord() const = 0;
virtual const char* GetNextWord() const = 0;
virtual const char* GetCurrentWord() const = 0;
virtual void SelectCurrentWord() = 0;
virtual void ReplaceCurrentWord(const char* szWord) = 0;
virtual void ClearSelection() = 0;
};
#endif // !defined(AFX_ISpellCheck_H__7741547B_BA15_4851_A41B_2B4EC1DC12D5__INCLUDED_)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?