296 lines
6.1 KiB
C
296 lines
6.1 KiB
C
#if !defined(__KINGTOUCH_H__)
|
|
#define __KINGTOUCH_H__
|
|
|
|
// Description:
|
|
// 公共数据和符号定义
|
|
// 使用方法:在工程的stdafx.h中所有KT头文件之前包含 "Kingtouch.h"
|
|
// Company: Kingtouch Software Corporation. Copyright 2002-2005
|
|
// Author: WangYongguang
|
|
// Date: 2002.05.01
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
// 动态库导出导入宏定义
|
|
#define KT_API_EXPORT __declspec(dllexport)
|
|
#define KT_API_IMPORT __declspec(dllimport)
|
|
|
|
// 公司和联系方式定义
|
|
#define KT_COMPANY_DESC_EN _T("Beijing Shanghua Inc")
|
|
#define KT_COMPANY_DESC_CH _T("北京上华软件开发有限公司")
|
|
#define KT_COMPANY _T("Sh")
|
|
#define KT_HTTP _T("www.shanghua.com.cn")
|
|
#define KT_EMAIL _T("shanghua@gmail.com")
|
|
#define KT_PHONENUMBER _T("010-0000000")
|
|
#define KT_FAXNUMBER _T("010-0000000")
|
|
|
|
// 产品注册表项和健值名称定义
|
|
#define APP_SETTING_SECTION _T("Settings")
|
|
#define SEARCH_PATH_SECTION _T("Settings")
|
|
#define PRODUCT_INFO_SECTION _T("Settings")
|
|
#define APPLICATION_PATH_KEY _T("AppPath")
|
|
#define SUPPORT_PATH_KEY _T("SupportPath")
|
|
#define TEMPLATE_PATH_KEY _T("TemplatePath")
|
|
#define AUTOSAVE_PATH_KEY _T("AutoSavePath")
|
|
#define HELP_PATH_KEY _T("HelpPath")
|
|
#define USER_NAME_KEY _T("UserName")
|
|
#define PRODUCT_KEY_KEY _T("ProductKey")
|
|
#define PRODUCT_ID_KEY _T("ProductId")
|
|
#define REGISTER_ID_KEY _T("RegisterId")
|
|
#define USER_COMPANY_KEY _T("UserCompany")
|
|
|
|
// 定义是否允许OEM,不定义即不允许
|
|
#define __KT_OEM_PERMISSION__
|
|
|
|
// 事件声音定义
|
|
// 弹出窗口风格
|
|
// TPM_LEFTALIGN
|
|
// TPM_CENTERALIGN
|
|
// TPM_RIGHTALIGN
|
|
// TPM_TOPALIGN
|
|
// TPM_VCENTERALIGN
|
|
// TPM_BOTTOMALIGN
|
|
#define TPM_INVERTHORZ TPM_NONOTIFY
|
|
#define TPM_INVERTVERT TPM_VERTICAL
|
|
// 弹出窗口消息
|
|
#define TPM_CREATED 1
|
|
#define TPM_DROPDOWN 2
|
|
#define TPM_CLOSEUP 3
|
|
// 弹出窗口消息数据
|
|
typedef struct NMTpInfo{
|
|
HWND hWnd;
|
|
UINT nMsg;
|
|
UINT nCode;
|
|
LPARAM lParam;
|
|
}NMTPINFO, *LPNMTPINFO;
|
|
|
|
#include <afxtempl.h>
|
|
// 定义通用数据类型
|
|
typedef CArray<int, int> CIntArray;
|
|
typedef CArray<double, double> CDoubleArray;
|
|
typedef CArray<CPoint, CPoint&> CPointArray;
|
|
typedef CMap<CString, LPCTSTR, double, double> CMapStringToDouble;
|
|
|
|
#ifndef _ttof
|
|
#define _ttof(pszVal) _tcstod((pszVal), NULL)
|
|
#endif
|
|
|
|
// 数学计算定义
|
|
#define PI_2 1.5707963267948966192313216916398
|
|
#ifndef PI
|
|
#define PI 3.1415926535897932384626433832795
|
|
#endif
|
|
#define _2PI 6.2831853071795864769252867665590
|
|
#include <math.h>
|
|
// 浮点数相等比较时的最大误差值
|
|
#define KTTOL 1.0e-10
|
|
// 判断两浮点数是否相等
|
|
#define IsEqual(dVal1, dVal2) (fabs((dVal1) - (dVal2)) <= KTTOL)
|
|
#define _IsZero_(dVal) (fabs(dVal) <= KTTOL)
|
|
// 弧度角度转换
|
|
#define AsDegree(dVal) ((dVal) * 180.0 / PI)
|
|
#define AsRadian(dVal) ((dVal) * PI / 180.0)
|
|
// 转换浮点数精度
|
|
inline double CvtPrec(double dVal, int iPrec)
|
|
{
|
|
double dPow = pow(10.0, iPrec);
|
|
modf(dVal * dPow, &dVal);
|
|
return (dVal / dPow);
|
|
}
|
|
|
|
#if _MFC_VER > 0X0700
|
|
#ifdef _tcscpy
|
|
#undef _tcscpy
|
|
#define _tcscpy(des, src) _tcscpy_s(des, (_tcslen(src) + 1) * sizeof(TCHAR), src)
|
|
#endif // _tcscpy
|
|
#ifdef _tcsncpy
|
|
#undef _tcsncpy
|
|
#define _tcsncpy(des, src, num) _tcsncpy_s(des, (num + 1) * sizeof(TCHAR), src, num)
|
|
#endif // _tcsncpy
|
|
#ifdef _tcscat
|
|
#undef _tcscat
|
|
#define _tcscat(des, src) _tcscat_s(des, (_tcslen(des) + _tcslen(src) + 1) * sizeof(TCHAR), src)
|
|
#endif // _tcscat
|
|
#ifdef _vsntprintf
|
|
#undef _vsntprintf
|
|
#define _vsntprintf(buf, num, fmt, args) _vsntprintf_s(buf, (num + 1) * sizeof(TCHAR), num, fmt, args)
|
|
#endif // _vsntprintf
|
|
#ifdef _stscanf
|
|
#undef _stscanf
|
|
#define _stscanf _stscanf_s
|
|
#endif // _stscanf
|
|
#endif // _MFC_VER > 0X0700
|
|
|
|
// 通用枚举类型定义
|
|
struct KT
|
|
{
|
|
// 应用程序消息
|
|
enum EModuleMsg
|
|
{
|
|
eUnknownMdlMsg = 0,
|
|
eLoad ,
|
|
eUnload ,
|
|
eDocReady ,
|
|
eDocSaved ,
|
|
eDocClose ,
|
|
eGetMdlGuid ,
|
|
eGetMdlName ,
|
|
eGetMDLDesc ,
|
|
eGetMDLVersion ,
|
|
eGetManufacturer ,
|
|
};
|
|
|
|
// 服务消息
|
|
enum EServiceMsg
|
|
{
|
|
eUnknownSrvMsg = 0,
|
|
eRegist = 1,
|
|
eUnregist ,
|
|
eInit ,
|
|
eRelease ,
|
|
eActive ,
|
|
eInactive ,
|
|
eGetIcon ,
|
|
eGetSrvGuid ,
|
|
eGetSrvName ,
|
|
eGetSrvDesc ,
|
|
eGetSrvVersion ,
|
|
eShowCalcBar ,
|
|
eShowMsgBar ,
|
|
eAddDwgView ,
|
|
eCalcBarWidth ,
|
|
};
|
|
|
|
// 应用程序类型定义
|
|
enum EAppType
|
|
{
|
|
eUnknownApp = 0,
|
|
eDllApp = 1,
|
|
eArxApp = 2,
|
|
eExeApp = 3,
|
|
};
|
|
|
|
// 文件类型
|
|
enum EFileType
|
|
{
|
|
eUnknownFile = 0,
|
|
eExeFile = 1,
|
|
eDllFile ,
|
|
eUserFile1 ,
|
|
};
|
|
|
|
// 搜索类型
|
|
enum EFilerSeekType
|
|
{
|
|
eFromStart = 0,
|
|
eFromCurrent ,
|
|
eFromEnd ,
|
|
};
|
|
|
|
// 存取类型
|
|
enum EAccessType
|
|
{
|
|
eForRead = 0,
|
|
eForWrite ,
|
|
};
|
|
|
|
// 图形驱动类型
|
|
enum EGsDriverType
|
|
{
|
|
eOpenGL = 0,
|
|
eDirectX ,
|
|
};
|
|
|
|
// 视口缩放类型
|
|
enum EZoomType
|
|
{
|
|
eZoomNone = 0,
|
|
eFitWidth ,
|
|
eFitHeight ,
|
|
eFullSize ,
|
|
eZoomAll ,
|
|
ePan ,
|
|
eZoomWindow ,
|
|
eZoomScale ,
|
|
};
|
|
|
|
// 错误代码
|
|
enum EErrorCode
|
|
{
|
|
eOk = 0,
|
|
eUnknownError ,
|
|
eCOMError ,
|
|
eOutOfMemory ,
|
|
eExpresionFalse ,
|
|
eNotImplemented ,
|
|
eInvalidInput ,
|
|
eNullPointer ,
|
|
eInvalidPointer ,
|
|
eInvalidVTable ,
|
|
eInvalidKind ,
|
|
eEmptyBuffer ,
|
|
eOutOfBound ,
|
|
eDataSignError ,
|
|
eWindowCreateError ,
|
|
|
|
eInvalidFileName ,
|
|
eInvalidFileType ,
|
|
eInvalidFileVersion ,
|
|
eWriteFileError ,
|
|
ePrintFileError ,
|
|
|
|
eRegistryCreateError ,
|
|
eRegistryValueExists ,
|
|
eRegistryWriteError ,
|
|
eRegistryDeleteError ,
|
|
|
|
eModuleAlreadyLoaded ,
|
|
eModuleLoadError ,
|
|
eModuleEntryError ,
|
|
eModuleVersionError ,
|
|
eModuleNotFind ,
|
|
eModuleLocked ,
|
|
|
|
eServiceRegisterError ,
|
|
eServiceNotFind ,
|
|
eServiceLocked ,
|
|
eServiceGuidNotFind ,
|
|
|
|
eObjectReadAccess ,
|
|
eObjectWirteAccess ,
|
|
eObjectNotReadAccess ,
|
|
eObjectNotWriteAccess ,
|
|
eObjectMultiReadAccess ,
|
|
eObjectAlreadyClosed ,
|
|
eObjectNotFind ,
|
|
eObjectAddError ,
|
|
eObjectAccessError ,
|
|
eObjectClassExists ,
|
|
eObjectClassRemoveError ,
|
|
eObjectClassNotFind ,
|
|
eObjectAlreadyProxy ,
|
|
|
|
eVirtualMemReserveError ,
|
|
eVirtualMemCommitError ,
|
|
eVirtualMemFreeError ,
|
|
eVirtualMemAccessError ,
|
|
eVirtualMemOutOfPage ,
|
|
|
|
eSysOptPageAddError ,
|
|
eSysOptPageRemoveError ,
|
|
|
|
eDatabaseConnectError ,
|
|
|
|
eMsgHandlerNotFind ,
|
|
eMsgHandlerHasRegistered ,
|
|
eMsgHandlerRegisterError ,
|
|
|
|
eReactorNotFind ,
|
|
eReactorHasRegistered ,
|
|
eReactorRegisterError ,
|
|
};
|
|
};
|
|
|
|
#endif // !defined(__KINGTOUCH_H__)
|