Inventor Customization - Show MessageBox at Home when start the Inventor

Inventor Customization - Show MessageBox at Home when start the Inventor

Khoa_NguyenDang
Advocate Advocate
772 Views
2 Replies
Message 1 of 3

Inventor Customization - Show MessageBox at Home when start the Inventor

Khoa_NguyenDang
Advocate
Advocate

Khoa_NguyenDang_0-1612371869413.png

Hi everybody 

I want to show automatically the message box at any time I start the Inventor Professional (show on the Home page - like the picture)

Do anybody know how to do it with API, I use Visual Studio for code

 

Thank you so much

0 Likes
Accepted solutions (2)
773 Views
2 Replies
Replies (2)
Message 2 of 3

dutt.thakar
Collaborator
Collaborator
Accepted solution

@Khoa_NguyenDang 

 

At the beginning of your code, can't you put a code that opens up Inventor, and just after that your message box pops up?

 

Check out the below thread on how to start Inventor with Visual studio code.

https://forums.autodesk.com/t5/inventor-customization/how-to-start-inventor-open-file-and-save-it/td...

 

Please test it and see how it works.

 

Hope this will be helpful.

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 3 of 3

alewer
Advocate
Advocate
Accepted solution

If you are writing an add in, code in the StandardAddInServer.Activate will run every time that the add in starts. For example I can create a new add in from the template. I modify the StandardAddInServer.Activate by adding a single line of code to create a message box that says "hello." I am using C# but for VS and others, code in the Activate member will  run at addin startup. You can use this approach to show the user a message box, form, or perform any action that you would like.

    public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
    {
      // This method is called by Inventor when it loads the addin.
      // The AddInSiteObject provides access to the Inventor Application object.
      // The FirstTime flag indicates if the addin is loaded for the first time.
      
      // Initialize AddIn members.

      // TODO: Add ApplicationAddInServer.Activate implementation.
      // e.g. event initialization, command creation etc.
      m_inventorApplication = addInSiteObject.Application;

      System.Windows.Forms.MessageBox.Show("hello"); //this show a message box every time the addin starts
    }

 

Once you have the add in installed you need to make sure that you have set the add in to load automatically (Tools -> Add-Ins, check "Loaded/Unloaded" and "Load Automatically"). This will make sure that the add in loads when Inventor starts.

Addin.PNG

 

You can use this approach to show a message box or form to the user. Basically any code that you put in Activate() will be run every time the addin starts.

0 Likes