RibbonGenerator Details: Windows Ribbon for WinForms

Let take a look into the details of RibbonGenerator of Windows Ribbon for WinForms

What is RibbonGenerator doing?

It generates .ribbon files that contains the definition of the commands and controls and can be used to display a Ribbon control on a Windows Form.

What type of application is RibbonGenerator?

There two applications available that can be used to generate .ribbon files.

  • A custom tool that can be used directly inside Visual Studio and
  • A console application that can be used from command line

Both application are having the same functionality.

How is RibbonGenerator generating .ribbon files?

Because there is no API available, the tool is “just” executing a .bat file. It is a custom .bat file. The content is created by the tool. After the first invocation the “template.bat” is placed in the following folder:
C:\Users\<username>\AppData\Local\RibbonGenerator
You can customize it. When you delete it, it will be recreated after the next invocation of RibbonGenerator.

What does this .bat file doing?

Let take a look into the template.bat file.

"C:\Program Files\Microsoft SDKs\Windows\v7.0\bin\UICC.exe" "{XmlFilename}" "{BmlFilename}" /res:"{RcFilename}"
"C:\Program Files\Microsoft SDKs\Windows\v7.0\bin\rc.exe" /v "{RcFilename}"
cmd /c "("%VS100COMNTOOLS%..\..\VC\bin\vcvars32.bat") && ("%VS100COMNTOOLS%..\..\VC\bin\link.exe" /VERBOSE /NOENTRY /DLL /OUT:"{DllFilename}" "{ResFilename}")"
  1. UICC.exe (available in Windows 7 SDK) is executed to generate a resource definition script file of the Ribbon XAML
  2. rc.exe (available in Windows 7 SDK) is executed to generate a .res file – a windows resource file
  3. link.exe (available in Visual Studio 2010 or Visual C++ 2010 Express)) is executed to generate an unmanaged .dll file. This file is the .ribbon file that can be used by Ribbon control!

The placeholder in there beginning with an “{” are all replaced by the tool. All files that are created will be deleted at the end of the generation process. Only the .ribbon file ({ResFilename} will not be deleted.

Questions:

Is is possible to use Windows 8 SDK?

Yes, the Windows 8 SDK contains UICC.exe and RC.exe, but the template.bat file must be modified to point to the files. You will find the tools by default in the following directory:

C:\Program Files\Windows Kits\8.0\bin\x86

You can download the Windows 8 SDK from there…

http://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspx

 

Advertisements

15 thoughts on “RibbonGenerator Details: Windows Ribbon for WinForms

  1. Ribbon for WinForms: More Details On RibbonGenerator Tool…

    My associate, Bernhard Elbl , as published another two posts on his blog further explaining the latest…

  2. Pac-Man says:

    Thanks so much! Exactly the information I needed to “fix” the tool because the paths were different on my PC.

  3. tonielro says:

    I have windows SDK 7.0A installed but I couldn’t see UICC.ex and rc.ex in the windows sdk folder. Could that be the reason I could not be able to use the ribbon control?

  4. RibbonGenerator is not required to run the sample or to compile the sample app. RibbonGenerator regenerates the .ribbon file if the ribbon xaml changes. You need all toos (UICC.exe …) installed and the template.bat must be correct. For further assistance you can use codeplex. http://windowsribbon.codeplex.com/workitem/list/basic Thanks

  5. […] (Update) If you have problems, you can find more detailed information in the following posts. RibbonGenerator Details: Windows Ribbon for WinForms RibbonGenerator for Visual Studio 2010 Express Editions: Windows Ribbon for WinForms This guidance […]

  6. Allen says:

    Good day all!!!

    I wanted to know if you can use RibbonLib to create a menu dynamically from a database. And if you can how would I go about doing this???

    • Bernhard says:

      No, this is generally not possible. “Recent Items” are only dynamic items. You can look at the samples provided. Every available features is shown there. For more detailed information you can look at MSDN Ribbon Framework.

  7. Lgon says:

    Hello, all. I need help. I recently migrated from Windows 7 Professional 32-bit to Windows 7 Enterprise 64-bit. On the previous machine I had been successfuly using the Windows Ribbon for WinForms v2.6 in Visual Studio 2010 Professional (SP1). On the new machine I’m having trouble getting the RibbonGenerator to work. The error I receive when I right-click on the ribbon xml file (Ribbon.xml in my case) then click ‘Run Custom Tool’ is “Generation failed. Error: uicc.exe failed to generate .bml or .rc file”. Is anyone able to provide some guidance as to what the problem may be? I have closely followed the instructions provided on Bernhard’s blog but am still having trouble.

  8. […] Quickstart Tutorial: Windows Ribbon for WinForms RibbonGenerator for Visual Studio 2010 Express Edit… Windows Ribbon for WinForms in Visual Studio 2013 […]

  9. […] Quickstart Tutorial: Windows Ribbon for WinForms RibbonGenerator for Visual Studio 2010 Express Edit… Windows Ribbon for WinForms in Visual Studio 2013 […]

  10. Conservative Atheist says:

    It doesn’t work. The tool is never invoked and no error msg. The console tool exits silently too. Why can’t we just execute the bat file directly anyway?

  11. panwar says:

    Hi Bernhar,Can you please let me know how to make the XML to access Resource file
    when i do this and run the tool or .bat file .it shows Ribbon control button name {Resource:Home}.
    can you help me on this ?
    can you let me know about the localisation of the ribbon control?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: