112 lines
2.6 KiB
C++
112 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
|
|
#define WINVER 0x0600
|
|
|
|
#pragma warning(disable: 4786)
|
|
|
|
//- 'DEBUG workaround' below prevents the MFC or ATL #include-s from pulling
|
|
//- in "Afx.h" that would force the debug CRT through #pragma-s.
|
|
#if defined(_DEBUG) && !defined(AC_FULL_DEBUG)
|
|
#define _DEBUG_WAS_DEFINED
|
|
#undef _DEBUG
|
|
#pragma message ("Compiling MFC / STL / ATL header files in release mode.")
|
|
#endif
|
|
|
|
#pragma pack (push, 8)
|
|
#pragma warning(disable: 4786 4996)
|
|
|
|
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
|
|
|
#include <afxwin.h> // MFC core and standard components
|
|
#include <afxext.h> // MFC extensions
|
|
|
|
#ifndef _AFX_NO_OLE_SUPPORT
|
|
#include <afxole.h> // MFC OLE classes
|
|
#include <afxodlgs.h> // MFC OLE dialog classes
|
|
#include <afxdisp.h> // MFC Automation classes
|
|
#endif
|
|
|
|
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
|
#include <afxcmn.h> // MFC support for Windows Common Controls
|
|
#endif
|
|
|
|
#include <map>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "KTCad.h"
|
|
#include <afxdhtml.h>
|
|
#include <afxwin.h>
|
|
|
|
extern HINSTANCE _hdllInstance;
|
|
|
|
#ifdef _DEBUG_WAS_DEFINED
|
|
#define _DEBUG
|
|
#undef _DEBUG_WAS_DEFINED
|
|
#endif
|
|
|
|
#if ARX > 19
|
|
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;
|
|
}
|
|
|
|
//inline int ads_getinput(TCHAR *psz)
|
|
//{
|
|
// return procsess2arg(::acedGetInput, psz);
|
|
//}
|
|
|
|
inline int acedGetInput(TCHAR *psz)
|
|
{
|
|
return procsess2arg(::acedGetInput, 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 acedFindFile(const TCHAR *pfname, TCHAR *psz)
|
|
{
|
|
return procsess3arg(::acedFindFile, pfname, psz);
|
|
}
|
|
|
|
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;
|
|
}
|
|
#endif
|
|
|