AnnRestrictCursor example for C++ Builder
void TForm1::ExampleAnnRestrictCursor (HANNOBJECT hObject )
{
long hContainer;
L_INT nObjectType;
double dBoundsTop;
double dBoundsLeft;
double dBoundsWidth;
double dBoundsHeight;
double dBoundsRight ;
double dBoundsBottom ;
RECT rcClipOld;
nObjectType= LEADAnn1->AnnGetType(hObject);
if(( nObjectType != ANNOBJECT_AUTOMATION) && (nObjectType != ANNOBJECT_CONTAINER) )
ShowMessage("This object is not an Automation Object and it is not a Container Object.");
hContainer = LEADAnn1->AnnContainer;
dBoundsTop = LEADAnn1->AnnRectTop[hObject];
dBoundsLeft = LEADAnn1->AnnRectLeft[hObject];
dBoundsWidth = LEADAnn1->AnnRectWidth[hObject];
dBoundsHeight = LEADAnn1->AnnRectHeight[hObject];
LEADAnn1->PointsCount = 2;
LEADAnn1->AnnContainerPointX[2] = dBoundsLeft;
LEADAnn1->AnnContainerPointY[2] = dBoundsTop;
LEADAnn1->AnnConvert(hObject, ANNCONVERT_TO_CLIENT);
dBoundsLeft = LEADAnn1->ClientPointX[0];
dBoundsTop = LEADAnn1->ClientPointY[0];
dBoundsRight = (dBoundsWidth + dBoundsLeft) + 10;
dBoundsBottom = (dBoundsHeight + dBoundsTop) + 10;
dBoundsTop = dBoundsTop - 10;
dBoundsLeft = dBoundsLeft - 10;
LEADAnn1->AnnRestrictCursor(hContainer, (long)dBoundsLeft, (long)dBoundsTop, (long)dBoundsRight, (long)dBoundsBottom, 0, 0, FALSE);
rcClipOld.top= LEADAnn1->AnnTopPreviousClip;
rcClipOld.left= LEADAnn1->AnnLeftPreviousClip;
rcClipOld.right= LEADAnn1->AnnRightPreviousClip;
rcClipOld.bottom= LEADAnn1->AnnBottomPreviousClip;
// When done with the restricted cursor, use the line below
ClipCursor ( &rcClipOld );