122 lines
2.5 KiB
C++
122 lines
2.5 KiB
C++
#include "stdafx.h"
|
|
#include "afxdllx.h"
|
|
#include <rxregsvc.h>
|
|
|
|
// sg modify 100311 删除CTemporaryResourceOverride时调整资源
|
|
/*
|
|
// Modify and Add following 3 lines
|
|
static AFX_EXTENSION_MODULE arxmfcDLL;
|
|
extern HWND adsw_acadMainWnd();
|
|
|
|
#if (ADS<=14)
|
|
extern "C" HINSTANCE _hdllInstance;
|
|
#else
|
|
extern "C" {
|
|
HINSTANCE _hdllInstance;
|
|
}
|
|
*/
|
|
|
|
HINSTANCE _hdllInstance = NULL;
|
|
AC_IMPLEMENT_EXTENSION_MODULE(arxmfcDLL);
|
|
|
|
extern "C" int APIENTRY
|
|
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
|
{
|
|
/*
|
|
_hdllInstance = hInstance;
|
|
return 1; // ok
|
|
*/
|
|
if (dwReason == DLL_PROCESS_ATTACH)
|
|
{
|
|
_hdllInstance = hInstance;
|
|
arxmfcDLL.AttachInstance(hInstance);
|
|
//InitAcUiDLL();
|
|
}
|
|
else if (dwReason == DLL_PROCESS_DETACH)
|
|
{
|
|
arxmfcDLL.DetachInstance();
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
//#endif
|
|
|
|
//extern BOOL g_bDwgBegin;
|
|
/*
|
|
HWND hWndACAD = NULL;
|
|
MY_RES_HERE;
|
|
|
|
extern "C" BOOL APIENTRY //name modified
|
|
InitModule(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)//name modified
|
|
{
|
|
if (dwReason == DLL_PROCESS_ATTACH) {
|
|
// Extension DLL one-time initialization
|
|
if(!AfxInitExtensionModule(arxmfcDLL, hInstance))
|
|
return 0;
|
|
CTemporaryResourceOverride::SetDefaultResource(_hdllInstance);
|
|
// Insert this DLL into the resource chain
|
|
new CDynLinkLibrary(arxmfcDLL);
|
|
|
|
}
|
|
else if (dwReason == DLL_PROCESS_DETACH)
|
|
{
|
|
AfxTermExtensionModule(arxmfcDLL);
|
|
//AfxMessageBox("Terminating!\n");
|
|
}
|
|
return 1; // ok
|
|
}
|
|
*/
|
|
|
|
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:
|
|
// InitModule(_hdllInstance, DLL_PROCESS_ATTACH, NULL);
|
|
acrxUnlockApplication(pkt); //Server程序必须锁住,不让卸载
|
|
acrxDynamicLinker->registerAppMDIAware(pkt);
|
|
/*
|
|
#if(ADS>14)
|
|
acrxDynamicLinker->registerAppMDIAware(pkt);
|
|
#endif
|
|
hWndACAD = adsw_acadMainWnd();
|
|
*/
|
|
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:
|
|
// InitModule(_hdllInstance, DLL_PROCESS_DETACH, NULL);
|
|
break;
|
|
}
|
|
return AcRx::kRetOK;
|
|
}
|
|
|
|
|
|
|
|
|
|
|