Files
envi-code/SourceCode/Code2026/tg_shs/shs_kernal/arxmain.cpp
T
2026-09-28 15:28:50 +08:00

82 lines
1.7 KiB
C++

#include "stdafx.h"
#include "afxdllx.h"
#include <rxregsvc.h>
#include <AcExtensionModule.h>
#include "TDbExtentsZoneTable.h"
#ifdef TASD
extern CMapPtrToPtr g_mapDb2ZoneTable;
extern void SaveZoneTbl(AcDbDatabase* pDb, TDbExtentsZoneTable* pZoneTbl);
#endif
HINSTANCE _hdllInstance = NULL ;
AC_IMPLEMENT_EXTENSION_MODULE(arxmfcDLL);
extern void InitAol(const TCHAR *szAppName);
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_hdllInstance = hInstance;
arxmfcDLL.AttachInstance(hInstance);
InitAol(TCHXD);
InitGeLib();
}
else if (dwReason == DLL_PROCESS_DETACH)
{
arxmfcDLL.DetachInstance();
}
return TRUE;
}
void OnLoadApp();
void OnUnloadApp();
int OnDwgLoaded();
int OnDwgUnload();
int OnDoFunc();
int DoNothing()
{
return RSRSLT;
}
extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
int nUnloadDwg=0;
switch (msg)
{
case AcRx::kInitAppMsg:
acrxUnlockApplication(pkt); //Server程序必须锁住,不让卸载
acrxDynamicLinker->registerAppMDIAware(pkt);
OnLoadApp();
break;
case AcRx::kLoadDwgMsg:
OnDwgLoaded();
break;
case AcRx::kInvkSubrMsg:
OnDoFunc();
break;
case AcRx::kSaveMsg:
break;
case AcRx::kUnloadDwgMsg: //Bug no message coming in R14
nUnloadDwg++;
#if (ADS>14) // R14不能发送这个消息, 因此在DbReactor中处理, R15则在此处理
OnDwgUnload();
#endif
break;
case AcRx::kUnloadAppMsg:
//add by whl for test version
#ifdef TIME_LIMIT
AddTime();
#endif
OnUnloadApp();
InitGeLib(FALSE); //add by xlc on 100610 清理范围缓冲
// InitModule(_hdllInstance, DLL_PROCESS_DETACH, NULL);
break;
}
return AcRx::kRetOK;
}