C++
ACAD_PORT bool acedSetOLELock( int handle, int flags = 0 );
File
aced.h
Description
This function is for use with OLE Automation applications. Whenever such an application uses any of the ObjectARX API functions, it must call this function to set a lock and then, when done, it needs to call acedClearOLELock() to clear the lock and allow other OLE applications their chance to lock and use ObjectARX API functions. handle is a lock "code" integer that is used to make sure that the setting and clearing of the lock are done by the same application. Both this function and acedClearOLELock() must be passed this integer lock code as an identifier.
The lock that is set is a "soft" lock, which means that applications can choose to ignore it, but if the lock is ignored, then it is very likely that memory will be corrupted. That can cause AutoCAD to terminate.
The flags argument can be set to a bitwise combination of any of the following (see the AcEdCommandStack::addCommand() documentation for information on what these represent):
ACRX_CMD_MODAL
ACRX_CMD_TRANSPARENT
ACRX_CMD_USEPICKSET
ACRX_CMD_REDRAW
ACRX_CMD_NOPERSPECTIVE
ACRX_CMD_NOMULTIPLE
ACRX_CMD_NOTILEMODE
ACRX_CMD_NOPAPERSPACE
ACRX_CMD_PLOTONLY
ACRX_CMD_NOOEM
ACRX_CMD_UNDEFINED
ACRX_CMD_INPROGRESS
ACRX_CMD_DEFUN
ACRX_CMD_NONEWSTACK
ACRX_CMD_NOINTERNALLOCK
ACRX_CMD_DOCREADLOCK
ACRX_CMD_DOCEXCLUSIVELOCK
ACRX_CMD_SESSION
ACRX_CMD_INTERRUPTIBLE
ACRX_CMD_NOHISTORY
ACRX_CMD_NO_UNDO_MARKER
The flags are used to determine whether or not the lock can be obtained. For example, if the ACRX_CMD_NOPAPERSPACE bit is set and the current document is in paper space, then the lock will not succeed and this function will return Adesk::kFalse.
If this function returns Adesk::kFalse, then there is already a lock in effect or conditions were not acceptable for the flags specified in the flags argument, and you should not call any ObjectARX API functions. If Adesk::kTrue is returned then your application has established a lock and can safely use the ObjectARX API functions.
Parameters
Parameters | Description |
---|---|
handle | Input integer lock code |
flags | Input bitwise OR of modes for which it is acceptable to get a lock |