|
使用 acedCommandC 时识别取消
[code]#include "acedCmdNF.h"
static void AdskMyTestCommand()
{
ads_point pt1;
int rt = ads_getpoint(
NULL,
_T("\nSelect first point: "), pt1);
int rs = acedCommandC
(
&MyCallback,
NULL,
RTSTR,
_T("_line"),
RT3DPOINT,
pt1,
RTNONE
);
acutPrintf(ACRX_T("\nAfter acedCommandC call.
acedCommandC is asynchronous..."));
}
static int MyCallback(void * pData)
{
if (acedCmdCWasCancelled())
{
acutPrintf(ACRX_T("\nCommand was cancelled..."));
return 0;
}
if(isLineActive())
{
int rs = acedCommandC
(
&MyCallback,
NULL,
RTSTR,
PAUSE,
RTNONE
);
acedCallBackOnCancel();
return 1;
}
CallWhenLineDone();
return 0;
}
static void CallWhenLineDone()
{
acutPrintf(ACRX_T("\nCommand completed."));
}
static Adesk::Boolean isLineActive()
{
struct resbuf rb;
acedGetVar(_T("CMDNAMES"),&rb);
if (_tcsstr(rb.resval.rstring, _T("LINE")))
return Adesk::kTrue;
return Adesk::kFalse;
}[/code] |
|