How to add your knowledge

Responding to Application Events

    Table of contents
    No headers

    The ApplicationPlugIn class contains a number of virtual functions that you override to respond to application events. These functions include:

    • OnPreLoad - Triggered first when the plugin is loaded and executed.
    • OnLoad - Triggered during the initialization process when the plugin is loaded and executed.
    • OnInitComplete - Triggered after the initialization process is complete.
    • OnInitMenus - Override this event to create application menu items.
    • OnUnload - Triggered when the plugin is unloaded.
      Note

      Not triggered when the AutoCAD Map 3D Client is closed.

    In the following example, an application plugin named “MyApplication” displays a dialog box when the plugin is first loaded:

    public class MyApplication : Autodesk.Map.IM.Forms.ApplicationPlugIn
    {
        public override void OnLoad(object sender, EventArgs e)
        {
            base.OnLoad(sender, e);
     
            // Display the dialog box (defined elsewhere).
            Form1 theForm = new Form1();
            theForm.Show();
        }
    }