I am trying to resolve a pesky problem involving conversion from const char* to CComBSTR. I am apparently not using quite the right format, when passing the input files to the function
hres = swDocMgr->GetDocument( docPath, swDmDocumentAssembly, VARIANT_TRUE, &res, &swDoc );
// http://stackoverflow.com/questions/606075/how-to-convert-char-to-bstr
// It appears the input files cannot be opened, due to some compiler specific conversion from char* to bstr:
CComBSTR docPath = filenamePtr; // filenamePtr is of type const char*
// How should I revise the statement above?
cerr << swDocMgr;
cerr << filenamePtr;
cerr << docPath;
cerr << swDmDocumentAssembly;
cerr << "hres: " << hres << ", S_OK = " << S_OK << ", res: " << res << ", swDoc: " << swDoc;
hres = swDocMgr->GetDocument( docPath, swDmDocumentAssembly, VARIANT_TRUE, &res, &swDoc );
cerr << swDocMgr;
cerr << filenamePtr;
cerr << docPath;
cerr << swDmDocumentAssembly;
cerr << "hres: " << hres << ", S_OK = " << S_OK << ", res: " << res << ", swDoc: " << swDoc;
The corresponding output typically looks like this:
0x975eb2c
D:/Baldur_Imagars_19june2016/Imagars LLC - Automatic Image Recognition/Collaboration - Portland State Univ/Ecosystem Evaluations/Kart2 team - Spring 2016/Capstone Stand Final AssemblyB/ME 492 Stand Hitch Connection.SLDASM
0xcbfc6cc
0
hres: 0 , S_OK = 0 , res: 4 , swDoc: 0x0
0x975eb2c
D:/Baldur_Imagars_19june2016/Imagars LLC - Automatic Image Recognition/Collaboration - Portland State Univ/Ecosystem Evaluations/Kart2 team - Spring 2016/Capstone Stand Final AssemblyB/ME 492 Stand Hitch Connection.SLDASM
0xcbfc6cc
0
hres: -2147221230 , S_OK = 0 , res: 4 , swDoc: 0x0
SolidworksApi macros