ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

why I can't pass the parameter of password into OPEN function?

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
183 Views, 0 Replies

why I can't pass the parameter of password into OPEN function?

I use COM to open an encrypted file in ARX. but I failed when I pass the parameter of password into the function. The AutoCAD still ask for the password when I run it. Why?

the code is:
CAcadApplication IApp;
CAcadDocuments IDocs;
CAcadDocument IDoc;

IDispatch *pDisp = acedGetAcadWinApp()->GetIDispatch(TRUE); //AddRef is called on the pointer
IApp.AttachDispatch(pDisp); // does not call AddRef()
IApp.put_Visible(true);
// Get the Documents collection
pDisp = IApp.get_Documents();
IDocs.AttachDispatch(pDisp);
pDisp = IApp.get_ActiveDocument(); //AddRef is called
IDoc.AttachDispatch(pDisp);

CString fullPath = "c:\\test2.dwg";

VARIANT vReadOnly;
VariantInit(&vReadOnly);
V_VT(&vReadOnly) = VT_BOOL;
V_BOOL(&vReadOnly) = VARIANT_TRUE;

CString pwd = "123";
VARIANT vPwd;
VariantInit(&vPwd);
V_VT(&vPwd) = VT_BSTR;
V_BSTR(&vPwd) = pwd.AllocSysString();

// Open it for Read-Only
IDoc = IDocs.Open(fullPath, vReadOnly, vPwd);
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost