Closing MindManager from Interop

  • 1
  • Problem
  • Updated 2 years ago
I've gone through the Documentation and intellisense, but I can't see any way via the Application object, to actually close/dispose MindManager. As a result, the application stays open even once my application has been closed.

This is my initialisation code;

ApplicationClass app = new ApplicationClass();
IDocument document = app.Documents.Add();
document.Activate();
// Do work
document.SaveAs("somepathhere");
document.Close();
Any help would be great.
Photo of Trent Jones

Trent Jones

  • 2 Posts
  • 0 Reply Likes

Posted 2 years ago

  • 1
Photo of Nick Duffill

Nick Duffill, Champion

  • 515 Posts
  • 172 Reply Likes
I am not certain whether the MindManager application itself will actually exit if you clear the application pointer, but it definitely won't if there are pointers to any of its objects left open (e.g. documents, topics, commands). So make sure that the code clears every MindManager object that it creates before clearing the MindManager application pointer.
Photo of Nigel Goult (Olympic & MIVAP)

Nigel Goult (Olympic & MIVAP)

  • 348 Posts
  • 135 Reply Likes
I was once faced with an application that did not have an api call to close or quit and I ended up monitoring the processes and getting the application task id when it was started. After using the application I then cleared everything I had created and then called an End Task on the process via its id.

Not the best or most elegant way to do it but it did work. Google will provide several examples if memory serves me correctly.

Regards
Nigel

Olympic Limited
More about Olympic MindManager Add-ins
Contact Nigel

Photo of Trent Jones

Trent Jones

  • 2 Posts
  • 0 Reply Likes
Hi Nick & Nigel,
I came up with the same idea as yourself, @Nigel and have been using the Kill option during the OnClose event of the form. Not ideal, but seems to be the best option. @Nick, nothing appears to implement IDisposable, so I guess setting the Document to null before setting the Application to null might achieve what you're saying, however it's no better than the Kill option I don't think.

No worries, if it's not an option, I'll work with what I've got. Thank you for your input.