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)
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
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.
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.
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.
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.
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.