pras123

Problem with Initializing ESRI Application

Discussion created by pras123 on Sep 23, 2013
Hi,
         I have below piece of Code in my C#.Net Program where I need to Call OnCreate method from Program.cs.
         But I am facing problem with sending an object hook which is of type IMxApplication.

Can You please let me know how to pass IMxApplication type object.

public override void OnCreate( object hook )
      {
         if( hook != null )
         {
            if( hook is IMxApplication )
            {
               ESRIApplication = (IMxApplication)hook;

               MxDocument = (IMxDocument)( (IApplication)ESRIApplication ).Document;

            }
         }
      }


public override void OnClick()
      {
        try
          {
              frmTrackChartToo fTCT = new frmTrackChartToo();

             fTCT.Exporter = new VisioExporter(
                 (IApplication)ESRIApplication);

              fTCT.Exporter.Subdivision = MapBuilder.Subdivisions[0];

              fTCT.Show();

          }
       }

Outcomes