ade_editislocked

Land Desktop Development ARX CPP SDK

Up a level
ade_editislocked
 
 

Gets lock information about an object if it is locked.

struct resbuf*

ade_editislocked(

ads_name ename);

Returns a resbuf list of lock information about the specified locked object, or, if it is not locked, NULL.

ename AutoCAD entity name.

You must release the resbuf.

The list of lock information returned by this function contains the following, in order:

  • Login name of the user who locked the object.
  • Name and path of the drawing that contains the object.
  • Date the object was locked.
  • Time the object was locked.
  • Name and path of the current drawing.

The following sample create a selection set of locked entities in a save back set using ade_editlocked(). A resbuf is then populated with edit lock information for each of the entities in the selection set using ade_editislocked(). That information is displayed and the resbuf is released as required.

ads_name selectionSet;
int nResultCode = ade_editlocked(selectionSet);
long ssLength;
acedSSLength( selectionSet, &ssLength; );
struct resbuf* pLockedEntitiesRb = NULL;
for( int i = 0; i < ssLength; ++i )
{
    ads_name ename;
    if( acedSSName( selectionSet, i, ename ) == RTNORM )
    {
        pLockedEntitiesRb = ade_editislocked(ename);
        if (NULL != pLockedEntitiesRb) {
            acutPrintf(
                    "\nThe locked entity contains the following information:");
            struct resbuf* rb = pLockedEntitiesRb;
            while(rb != NULL) {
                if (rb->restype == RTSTR) {
                    acutPrintf(
                            "\n\t\t\"%s\""
                            , rb->resval.rstring);
                }
                rb = rb->rbnext;
            }
        }
    }
}
acutRelRb(pLockedEntitiesRb);

You can change the format of the date and time strings through options in the International dialog box in the Microsoft Windows Control Panel.