2. Obtaining RibbonLib
If you look at the PreviewRibbon example code,
you'll find that it has a relatively large number of files containing
complex code. Writing a COM wrapper for the Ribbon isn't for the faint
of heart. With this in mind, you'll probably want to use a pre-written
wrapper to make your Ribbon development easier.
After you download the ZIP file, extract it. You'll
find .SLN files for both Visual Basic and C#. In addition, both Visual
Basic and C# examples are included with the library. The solutions will
require conversion for Visual Studio 2010. Simply follow the Visual
Studio Conversion Wizard prompts as you normally would to perform the
conversion. The conversion should proceed without error.
When you initially attempt to build the library and
its examples, you'll be discouraged to see a number of errors (36 of
them). The errors aren't due to any coding problem. The problem occurs
when you use the latest version of the Windows 7 SDK. Use the following
steps to correct the problem:
Right-click
an example project entry in Solution Explorer and choose Properties
from the context menu. You'll see the Properties window for that
project.
Select the Build Events tab as shown in Figure 1.
Notice that the Pre-Build Event Command Line field contains entries
that compile the XML file containing the Ribbon code into a DLL. You
must modify these entries to match the version of the Windows 7 SDK
installed on your system .
Click Edit Pre-Build. You'll see the Pre-Build Event Command Line dialog box shown in Figure 2.
Change
each of the directory entries in the dialog box to match the directory
setup on your machine. Be especially careful of the version numbers.
The example is configured to use version 7.0 of the Windows 7 SDK.
Choose Build => Build Solution to build the application.