My add-in doesn't often (not always) work in SW2013 64bit,
because the function "ISldWorks::INewDocument2" throws exception.
But the add-in always works well in SW2013 32bit and in SW2012 or earlier version.
Does anyone know such a situation.
Incidentally,source code is as follows
-----
CoInitialize(NULL);
try{
CComPtr
USES_CONVERSION;
HRESULT hres = swApp.CoCreateInstance(A2OLE("SldWorks.Application"), NULL, CLSCTX_LOCAL_SERVER);
if( hres != S_OK){
return;
}
CComBSTR wTemplateName;
swApp->GetUserPreferenceStringValue ( swDefaultTemplateAssembly, &wTemplateName );
// I confirmed that I can get a correct template name.
IModelDoc2* pModelDoc = NULL;
swApp->INewDocument2( wTemplateName, 0, 0, 0,&pModelDoc);
// access violation exception is thwrown in this function,
// and my add-in sometimes crashes...
swApp->ExitApp();
swApp = NULL;
}catch(...){}
CoUninitialize();
-----
Regards
SolidworksApi macros