From boitboy on 2013-10-11 09:38:14
锁定文档
//GLockDocument.h
#pragma once
#include "acdocman.h"
class GLockDocument
{
public:
GLockDocument()
{
pDoc=NULL;
if(acDocManager != NULL)
{
try
{
pDoc = acDocManager->curDocument();
if ((pDoc != NULL) && (acDocManager->lockDocument(pDoc) != Acad::eOk))
{
pDoc=NULL;
}
}
catch(...)
{}
}
}
~GLockDocument()
{
if ((acDocManager != NULL) && (pDoc != NULL))
{
try
{
acDocManager->unlockDocument(pDoc);
}
catch(...)
{}
}
}
private:
AcApDocument* pDoc;
};