newer 发表于 2021-1-7 17:55:06

Acad menu doesn't show when ARX application is demand loaded at startup


问题:
I have registered my ARX application using MFC to be demand loaded during
AutoCAD startup. My ARX application loads but the AutoCAD menu does not display
anymore. If I use MFC, why does everything work correctly?

解答:
This is caused because the following line in the 'InitModule()' function of your
ARX application is missing:


new CDynLinkLibrary (arxmfcDLL) ;
Here is the minimum InitModule() function you have to implement:


static AFX_EXTENSION_MODULE arxmfcDLL ;

extern BOOL InitModule (HINSTANCE hInstance, DWORD dwReason, LPVOID) {
    if ( dwReason == DLL_PROCESS_ATTACH ) {
      if ( !AfxInitExtensionModule (arxmfcDLL, hInstance) )
            return (0) ;
      new CDynLinkLibrary (arxmfcDLL) ;
    } else if ( dwReason == DLL_PROCESS_DETACH ) {
      AfxTermExtensionModule (arxmfcDLL) ;
    }
    return (1) ;
}


页: [1]
查看完整版本: Acad menu doesn't show when ARX application is demand loaded at startup