By Adam Nagy
I have my custom entity which I registered for load on proxy detection, but AutoCAD does not load it automatically when a drawing containing my entity is opened. What could be the problem?
Here is my code:
void RegisterDbxApp()
{
AcadAppInfo appInfo;
appInfo.setAppName(L"MYAPP");
HMODULE hModule=GetModuleHandle(L"MyApp.dll");
TCHAR modulePath[512];
DWORD pathLength = GetModuleFileName(hModule, modulePath, 512);
if (pathLength)
appInfo.setModuleName(modulePath);
appInfo.setAppDesc(L"My DBX module");
appInfo.setLoadReason(
AcadApp::LoadReasons(
AcadApp::kOnProxyDetection |
AcadApp::kOnLoadRequest));
appInfo.writeToRegistry(true,true);
}
Solution
When AutoCAD tries to find your object enabler application then it is using the application name you defined in the ACRX_DXF_DEFINE_MEMBERS macro, which in your case is:
ACRX_DXF_DEFINE_MEMBERS (
MyEnt, AcDbEntity,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kNoOperation, MyEnt,
"MYAPP"
"|Product Desc: My App"
"|Company: My Company"
"|WEB Address: www.mycompany.com"
)
Since the macro already converts the parameters to string, therefore the application name will get extra ” characters: “MYAPP” instead of MYAPP, so AutoCAD won’t find it in the registry:

You just have to remove the extra ” characters. This way AutoCAD can find your application in the registry and can load it the next time a drawing containing your entity is opened:
ACRX_DXF_DEFINE_MEMBERS (
MyEnt, AcDbEntity,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kNoOperation, MyEnt,
MYAPP
|Product Desc: My App
|Company: My Company
|WEB Address: www.mycompany.com
)

Leave a Reply