.exe (COM\Active X) as custom menu command

.exe (COM\Active X) as custom menu command

snappyjazz
Collaborator Collaborator
636 Views
5 Replies
Message 1 of 6

.exe (COM\Active X) as custom menu command

snappyjazz
Collaborator
Collaborator

Hello,

I made a .exe in Visual Studio using COM\Active X. It is a program dialog that the user picks a block to insert, the block gets inserted, then gets rotated. I have it working in VS, but now I want to operate it from autocad at the push of a button. So I copy\paste the .exe from the ...vsproj\bin\debug folder to a trusted location. Then I created and added a command to the menu of our cuix(see below). When I clicked the button it failed(see below). I tried googling my goal as well as the forums\help, but I couldn't find my exact situation or the answer is too complicated. Can you please help me in layman's terms. 🙂

 

snappyjazz_0-1656430404340.png

 

snappyjazz_1-1656430426285.png

 

0 Likes
Replies (5)
Message 2 of 6

Ed__Jobe
Mentor
Mentor

You can't run an exe (out-of-process) file inside AutoCAD's process. You need to change your VS project to a dll project (in-process). Then you use the NETLOAD command to load your dll. Create a command in the dll that you can call from the button macro. It seems that you are missing some basic knowledge on programming. I would pick up a book that teaches Object Oriented Programming, OOP.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 6

snappyjazz
Collaborator
Collaborator

I do have gaps in my limited programming knowledge. I am self taught after all and the few years I have been doing this has been just looking up specific concepts to accomplish goals. If as you say that learning in-process or out-of-process is basic then now's a good time to learn. However anything I look up on the subject goes to ASP.Net Core which is "a cross-platform, high-performance, open-source framework for building modern, cloud-enabled, internet-connected apps". This sounds like its a lot more complicated than vb.net; also I'm not sure what an internet-connected app has to do with working inside of or outside of autocad. If you think I need to figure out ASP.Net Core to accomplish my goal then I will, but can you understand my reluctance?

0 Likes
Message 4 of 6

Ed__Jobe
Mentor
Mentor
Accepted solution

No, you don't need to learn asp.net. This search "in-process application vs out-of-process" brought up this article for more info.

 

If you run TaskManager, you can get an idea about processes. See my screen capture. An EXE creates it's own running process. It can load dll's into it's process, creating another process running within it's own process. AutoCAD has many processes running. However, an exe cannot have another exe running in it's process. Each EXE starts it's own process. They can 'talk' to each other using COM, but your EXE can't run inside acad's EXE.

2022-06-28_13-45-32.png

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 5 of 6

snappyjazz
Collaborator
Collaborator

OOOH! That made more sense then reading about in-process for two hours. Thank you!

0 Likes
Message 6 of 6

Ed__Jobe
Mentor
Mentor

You're welcome.

 

I'm self-taught too. But being self-taught should include some education. That's why I suggested a book. You're trying to put a puzzle without the picture on the box. You need to understand how all the pieces fit together.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes