Is it possible to build a ribbon dynamically, without using external files?

164 Views Asked by At

I would like to know whether it is possible build a ribbon without being forced to use an external application (namely, uicc.exe) for compiling an .xml file into a .bml one, etc. In other words, is there any way to build a ribbon dynamically as it is the case with menus?

1

There are 1 best solutions below

0
On

The Ribbon Framework of Windows uses always the IUIFramework::LoadUI method to load the ribbon definition from the resource of your .exe file.

So, if you want to use a dynamic ribbon definition, you could use a external program loader of your .exe program:

  1. Create the .xml ribbon markup dynamically.
  2. Compile the .xml file with uicc.exe to the .bml file.
  3. Update the resource of your .exe program.
  4. Start your .exe program.

To compile the .xml file at runtime, you could enclose the uicc.exe into your program loader and save it inside the temp folder to execute it.

Indeed this solution is VERY bad, but it should work, I believe (I didn't test it). And this solution can be used before starting your .exe program only.