Files
envi-code/SourceCode/Code2026/AdsXRx/StdAfx.h
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

152 lines
3.5 KiB
C

#ifndef _STDAFX_H_
#define _STDAFX_H_
#pragma warning(disable: 4786)
#pragma warning(disable: 4996)
#pragma warning(disable: 4995)
#pragma warning(disable: 4275)
#pragma warning(disable: 4251)
#pragma warning(disable: 4819)
#define STRICT
#define _WIN32_WINNT 0x0600
#pragma once
#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
//#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS
#if defined(_DEBUG)
#define _DEBUG_WAS_DEFINED
#undef _DEBUG
#pragma message (" Compiling MFC header files in release mode.")
#endif
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <stdlib.h>
#include <stdio.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif
#include "ktcad.h"
#if (ARX > 19)
#include "acdb.h" // acdb definitions
#include "aced.h" // aced stuff
#include "adscodes.h"
#include "acedCmdNF.h"
#include "gs.h"
//////////////////////////////////////////////////////////////////////////
typedef int (*p2argF) (TCHAR *psz, size_t len);
typedef int (*p3argF) (const TCHAR *psz1, TCHAR *psz, size_t len);
#define BUFFER_LEN 1024
inline int procsess2arg(p2argF fun, TCHAR *psz)
{
if (!psz) return RTERROR;
TCHAR pBuf[BUFFER_LEN] = { 0, };
int nret = fun(pBuf, 512);
// 此处可能崩溃,注意长度
_tcscpy(psz, pBuf);
return nret;
}
inline int procsess3arg(p3argF fun, const TCHAR *psz1, TCHAR *psz)
{
if (!psz) return RTERROR;
TCHAR pBuf[BUFFER_LEN] = { 0, };
int nret = fun(psz1, pBuf, 512);
// 此处可能崩溃,注意长度
_tcscpy(psz, pBuf);
return nret;
}
#ifdef ads_getinput
#undef ads_getinput
#endif
AcGsView* acgsGetGsView(int nVp, bool bifNotCreate)
{
AcGsView* pView = acgsGetCurrentAcGsView(nVp);
if (pView == NULL)
{
AcGsKernelDescriptor descriptor;
pView = acgsObtainAcGsView(nVp, descriptor);
}
return pView;
}
inline int ads_getinput(TCHAR *psz) { return procsess2arg(::acedGetInput, psz); }
inline int acedGetInput(TCHAR *psz) { return procsess2arg(::acedGetInput, psz); }
inline int acedFindFile(const TCHAR *pfname, TCHAR *psz) { return procsess3arg(::acedFindFile, pfname, psz); }
inline int acedGetKword(const TCHAR *prompt, TCHAR *psz) { return procsess3arg(::acedGetKword, prompt, psz); }
inline int acedGetString(int cronly, const TCHAR *prompt, TCHAR *psz)
{
if (!prompt) return RTERROR;
TCHAR pBuf[512] = { 0, };
int nRet = ::acedGetString(cronly, prompt, pBuf, 512);
_tcscpy(psz, pBuf);
return nRet;
}
inline int acdbAngToS(ads_real v, int unit, int prec, TCHAR *psz)
{
if (!psz) return RTERROR;
TCHAR pBuf[512];
int nRet = ::acdbAngToS(v, unit, prec, pBuf, 512);
_tcscpy(psz, pBuf);
return nRet;
}
#ifdef acedPostCommand
#undef acedPostCommand
#endif
#define acedPostCommand acedPostCommandR20
inline Adesk::Boolean acedPostCommandR20(const TCHAR * cmd)
{
if (curDoc() && acDocManager)
acDocManager->sendStringToExecute(curDoc(), cmd);
return Adesk::kTrue;
}
#else
#include "adesk.h"
Adesk::Boolean acedPostCommand(const TCHAR *);
#endif
#include "math.h"
#include "Migration.h"
#ifdef AOL
#define GEOAPI __declspec(dllexport)
#else
#define GEOAPI __declspec(dllimport)
#endif
#include "XGlobalDef.h"
#include "AdsXRx.h"
#endif