This post is based on some information provided by Peter Muigg, a developer in
Germany Austria who has long been a friend of Autodesk. In fact, if memory serves me well – and do step in if I’m mis-remembering, Peter – back in 1995 when I first joined the company, Peter delivered German-language ObjectARX training on behalf of Autodesk.
Peter reached out with this tip just before the holiday break: he needed to display a dialog on AutoCAD startup, but found that it was too soon to do so on IExtentionApplication.Initialize() (it’s assumed this module is either demand- or auto-loaded, by the way – manual loading doesn’t tend to exhibit this issue).
I typically use the approach of posting a command/queueing up a LISP expression to execute on startup to do this, but Peter has successfully used the Application.Idle event, instead.
Here’s Peter’s C# code:
public class App : IExtensionApplication
static MyPalette _palette;
public void Initialize()
// ... other stuff
// Create a hook on the "Idle" event of the application class
Application.Idle += new EventHandler(Application_Idle);
void Application_Idle(object sender, EventArgs e)
// Remove the event handler as it is no longer needed
Application.Idle -= Application_Idle;
_palette = new MyPalette();
_palette.Visible = true;
The code itself shouldn't need any explanation – it's both simple and elegant. Thanks for sharing it, Peter!
Peter has since clarified he’s based in Innsbruck, so I’ve updated the post accordingly. My apologies for getting that wrong, especially being based in neighbouring Switzerland! :-(