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

Toolbar and acedCommand()

3 REPLIES 3
Reply
Message 1 of 4
Robert-
202 Views, 3 Replies

Toolbar and acedCommand()

Hello,



when I call an acedCommand implemented in a certain procedure through the acad command line or menu (*.mns file) it works without problems. But when I call the acedcommand through a toolbar or modeless dialog it returns the error code -5001.



Could somebody help to solve this problem?



with kind regards,

Robert
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Robert-

Hi Robert,

 

acedCommand(), acedInvoke(), and acedCmd() cannot be used from a
class=highlight>modeless

window. This is because your
class=highlight>modeless
window has its own message loop to
process
Windows' messages. Your modeless window
runs asynchronously from the AutoCAD
code.

Instead of doing direct
call into AutoCAD from your modeless window, send
an
expression on the AutoCAD command line to request AutoCAD to start a
command,
which can then do an optional
class=highlight>acedCommand
() call. You can do this using
sendStringToExecute().


--
Cheers,

 

Stephen Preston
Developer Technical Services
Autodesk

href="http://adn.autodesk.com">http://adn.autodesk.com

 

 

style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hello,


when I call an acedCommand implemented in a certain procedure through
the acad command line or menu (*.mns file) it works without problems. But when
I call the acedcommand through a toolbar or modeless dialog it returns the
error code -5001.

Could somebody help to solve this problem?


with kind regards,
Robert
Message 3 of 4
Robert-
in reply to: Robert-

Thanks for your advice. But I have still some problems.
So I call sendStringToExecute:

acDocManager->sendStringToExecute(acDocManager->document(acdbHostApplicationServices()->workingDatabase()), "\nSEARCHOBJECT", TRUE, FALSE, FALSE);



At the first call the autocad help is opened. In the command line is "_help" executed. At the second and all following calls my command "searchobject" is executed correctly.

When I use sendStringToExecute without "\n" my command is not executed. It is only pasted invisibly in the command line. I have to press enter to execute it.

Does there for exists a solvation?



with kind regards,

Robert
Message 4 of 4
Anonymous
in reply to: Robert-

Instead of "\nSEARCHOBJECT" use "SEARCHOBJECT\n"

You are passing a carriage return in front of the command string,
but it should appear after it.

--
http://www.acadxtabs.com


"Robert-" wrote in message news:f17ae3d.1@WebX.maYIadrTaRb...
> Thanks for your advice. But I have still some problems.
> So I call sendStringToExecute:
> acDocManager->sendStringToExecute(acDocManager->document(acdbHostApplicationServices()->workingDatabase()),
"\nSEARCHOBJECT", TRUE, FALSE, FALSE);
>
> At the first call the autocad help is opened. In the command line is "_help" executed. At the second and all following
calls my command "searchobject" is executed correctly.
> When I use sendStringToExecute without "\n" my command is not executed. It is only pasted invisibly in the command
line. I have to press enter to execute it.
> Does there for exists a solvation?
>
> with kind regards,
> Robert

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

Post to forums  

”Boost