Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Close other child windows of Inventor

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
saseendrankombath
579 Views, 5 Replies

Close other child windows of Inventor

I am using forms in my (vb.net 2012) addin and uses the below code to show and make Inventor as owner of my form. Need help to find and close all other child windows of Inventor before I load the addin form.

 

myForm = New frmAddinForm
Dim owner As New Windows.Forms.NativeWindow
owner.AssignHandle(m_inventorApplication.MainFrameHWND)
myForm.Show(owner)

 

5 REPLIES 5
Message 2 of 6
ekinsb
in reply to: saseendrankombath

The best, and easiest, solution in this case is not to try and close any other windows, but to implement your command within an InteractionEvents object.  When you start the associated InteractionEvents object it will have the effect of terminating the currently running command which will cause it's associated dialogs to be taken down too.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 6
saseendrankombath
in reply to: ekinsb

Thanks Brian,

By starting the interaction events, it terminates the active command window. But in case of an opened add-in window, is there any method to close it. In general only one window will be opened at a time. As an exceptional case if some user opens one after another the first one to be closed. I am trying to fool proof my add-ins. That’s why I am trying to close other windows of other add-ins. 

Message 4 of 6
saseendrankombath
in reply to: ekinsb

Thanks Brian,

By adding form close in InteractionEvents_OnTerminate sub the addin form get closed when another one loads with interactionEvents.Start(). This solved my problem.

Message 5 of 6
ekinsb
in reply to: saseendrankombath

I wouldn't worry about other add-ins.  They should also be using InteractionEvents and terminating when another command starts.  It's not really possible to police everyone else, especially if they aren't doing what they're supposed to.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 6 of 6
saseendrankombath
in reply to: ekinsb

Thaks brian,

This is what I done, I added the Interaction Events and terminating in my all add-ins. So everything working perfectly as they are supposed to.

 

Once again Thanks for giving big support.

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

Post to forums  

Autodesk Design & Make Report