ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

acedUsrBrk() isn't response on the Esc

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
312 Views, 3 Replies

acedUsrBrk() isn't response on the Esc

Is there a way to use acedUsrBrk() with acedSetStatusBarProgressMeterPos()
I have a problem with the following approach - there isn't ary response to Esc pressing

	int maxcount = 10000;
	acedSetStatusBarProgressMeter(_T("Infinity..."), 1, maxcount);
	int i = 1;
	do  {
		acedSetStatusBarProgressMeterPos(i++);
		if (i > maxcount) i = 1;
	} while (!acedUsrBrk());
	acedRestoreStatusBar();

 

3 REPLIES 3
Message 2 of 4
nick83
in reply to: Anonymous

try to use 

int acad_abortCycle(const ACHAR * abortString)
{
	int res = 0;
	CWinApp *app = acedGetAcadWinApp();
	CWnd *wnd = app->GetMainWnd ();
	MSG msg; 
	while (::PeekMessage (&msg, wnd->m_hWnd, 0, 0, PM_NOREMOVE)) 
	{ 
		if (!app->PumpMessage()) 
		{ 
			::PostQuitMessage(0); 
			break; 
		} 
	} 
	LONG lIdle = 0;
	while (app->OnIdle (lIdle++));

	res = acedUsrBrk();
	if(res == 1 && abortString != NULL) acutPrintf(abortString);
	return res;
}

instead of acedUsrBrk

} while (!::acad_abortCycle(_T("\nInfinity aborted")));

it works little longer... but it works :). 

Message 3 of 4
Anonymous
in reply to: Anonymous

It is very strange. I checked my old projects (Autocad 2000i - 2002) - it all worked fine.

Message 4 of 4
nick83
in reply to: Anonymous

sure, it should work up to 2009 or 2007, can't remember exactly. but then, suddenly, we got threads (they were before, but we did nothing to manage them), message queue, and several other funny features :). in that case, pressing ESC, become executing in main thread, and for getting keyboard event we have to look through all messages, that our main window (thread) gets. without the participation of a shaman we still can use acedGetXXX functions, but not an acedUsrBrk. they suddenly forgot to fix it :). so, use it as a workaround.

PS: objectarx documentation and samples for acedUsrBrk is the same from the 2005 up to 2021 🙂 too.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta