I've written about using MFC from a C++ Fusion add-in. You could also use .NET from your add-in, and it's even simpler to set up.
1) Create a C++ add-in inside the "Scripts and Add-Ins" Fusion dialog:
I'm leaving "Run on Startup" option above unchecked, because it would not be a good idea to pop up a modal dialog while Fusion is starting up. That would halt the startup process.
2) Open it for edit:
3) Add "Common Language Runtime Support" in your C++ project's Properties dialog
4) Place the Fusion related code inside a #pragma unmanaged /#pragma managed block
5) Add a "Windows Form" through "PROJECT" >> "Add New Item…"
Note: You can add any of the .NET Form controls to it as in case of a C# or VB.NET project. I've just added a list box for testing and filled it with items.
6) Create a function to show this dialog
a) In "MyForm.h" declare showDialog()
b) In "MyForm.cpp" implement the function
7) Now we can call it from the startup function called run()
a) Add #include "MyForm.h" to the top of "CustomNetUi.cpp"
b) Call showDialog() from run()
extern "C" XI_EXPORT bool run(const char* context) { app = Application::get(); if (!app) return false; ui = app->userInterface(); if (!ui) return false; showDialog(); return true; }










Leave a Reply