programming4us
programming4us
DESKTOP

Windows 7 Development : GETTING STARTED WITH THE RIBBON (part 1) - Obtaining the Windows 7 SDK

2/19/2015 12:53:47 AM

This first application, SimpleRibbon, uses the Windows Forms approach to adding Ribbon support to an application. In this application, you discover a number of fundamentals, such as how to use the Microsoft interop module to your advantage. You'll also obtain all the details needed to configure your system and create a simple Windows Forms application that employs the Ribbon. The example is purposely simple so that you can focus on setup, utilities, and technique.

NOTE

Whenever Microsoft introduces a technology that seems to make life difficult for the developer, a third-party vendor comes along to make things easier. Professional UI Solutions makes a set of Windows Forms controls called Elegant Ribbon that you can use to create an Office-like environment for your application. You can even download and try the controls out free.

7.1.1. Obtaining the Windows 7 SDK

There isn't any easy way to obtain the support you need for working with the Ribbon. Unlike the Taskbar examples, you really do need the Windows 7 Software Development Kit (SDK) to create Ribbon-based applications for Windows 7. Even the Microsoft-supplied Ribbon example requires the Windows 7 SDK to run. It would be nice if there were a managed code approach you could take, but the Ribbon relies on Component Object Model (COM) technology that relies on a good deal of C++ code.

GETTING MICROSOFT'S PREVIEWRIBBON EXAMPLE TO WORK

It's a good idea to at least view Microsoft's PreviewRibbon example before you perform much development work of your own, because managed code examples for the Ribbon are a bit scarce. In addition, getting Microsoft's example to work will also prepare your machine for your own development efforts and help you understand potential distribution problems for production applications. The following steps help you get the example to work properly:

  1. Open the example using Visual Studio 2010. You'll immediately notice that you need to convert it for use with Visual Studio 2010. The conversion should proceed without error.

  2. Try to compile the code to locate four errors within the application. The errors appear in the ConfigOptions.CS file.

  3. Change each of the val = ConfigurationSettings.AppSettings["StringValue"]; lines to read val = ConfigurationManager.AppSettings["StringValue"];. The code will compile at this point, but you still won't see the example work. That's because you haven't specified a Ribbon definition file for the example to use.

  4. Copy the BasicRibbon.XML into the Debug folder for the application, so the application can easily access it.

  5. Right-click the PreviewRibbon entry in Solution Explorer and choose Properties from the context menu.

  6. Select the Debug tab and type BasicRibbon.XML in the Command Line Arguments field.

You should be ready to go now. Assuming you have the Windows 7 SDK installed, the example should run. Choose Start All Programs Microsoft Windows SDK v7.1 Windows SDK 7.1 Command Prompt. Windows will open a command prompt. Change directories to the Debug folder of the PreviewRibbon application (normally \PreviewRibbon-src\source\bin). Type PreviewRibbon BasicRibbon.XML and press Enter.

Of course, you might want to run the example from within Visual Studio. In this case, open the App.CONFIG file. You'll see four entries in the <appSettings> tag. Uncomment these entries and ensure that the paths point to the locations of the utilities that the application requires. Here are the entries for Visual Studio 2010 using the Windows 7 SDK version 7.1 on a 64-bit system :

<add key="UiccPath"
value="C:\Program Files\Microsoft
SDKs\Windows\v7.1\Bin\UICC.exe" />

<add key="RCExePath"
value="C:\Program Files\Microsoft
SDKs\Windows\v7.1\Bin\RC.exe" />
<add key="LinkExePath"
value="C:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\Bin\Link.exe" />
<add key="ColorizationValues"
value="150, 127, 245; 25, 127, 245; 150, 71, 158" />

As an alternative to changing the App.CONFIG file, you can also change the paths provided by the sdkBinPath, vsBinPath32, and vsBinPath64 variables found in ToolHost.CS. Changing either file will work.


The Windows 7 SDK comes in two forms: Web installer and an International Standards Organization (ISO) package used to create a DVD. You can obtain the Web installer from http://www.microsoft.com/downloads/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b and the ISO version from http://www.microsoft.com/downloads/details.aspx?FamilyID=35AEDA01-421D-4BA5-B44B-543DC8C33A20. Whichever version you obtain, double-click the installer after the download to begin the installation. Follow the default setup instructions for installing the Windows 7 SDK on your system. A default installation will require 1.7 GB of hard-drive space.

NOTE

Make absolutely certain that you obtain the correct version of the Windows 7 SDK for your system. If you have a 64-bit version of Windows installed, you must download the 64-bit version of the Windows 7 SDK. Anyone using an Itanium system will need the Itanium version of the Windows 7 SDK. Attempting to install the incorrect version will result in a failure message that says the installer couldn't find a particular file (rather than telling you that you have the incorrect version of the SDK).

Other  
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 11) - Monitoring performance from the command line
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 10) - Configuring performance counter alerts
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part ) - Viewing data collector reports
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 8) - Collecting performance counter data, Collecting performance trace data
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 7) - Performance logging - Creating and managing data collector sets
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 6) - Resolving disk I/O bottlenecks, Resolving network bottlenecks
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 5) - Resolving performance bottlenecks - Resolving memory bottlenecks
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 4) - Comprehensive performance monitoring - Choosing views and controlling the display
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 3) - Comprehensive performance monitoring - Selecting performance objects and counters to monitor
  •  Windows Server 2012 : Comprehensive Performance Analysis and Logging (part 2) - Establishing performance baselines - Tracking the overall reliability of the server
  •  
    video
     
    Video tutorials
    - How To Install Windows 8

    - How To Install Windows Server 2012

    - How To Install Windows Server 2012 On VirtualBox

    - How To Disable Windows 8 Metro UI

    - How To Install Windows Store Apps From Windows 8 Classic Desktop

    - How To Disable Windows Update in Windows 8

    - How To Disable Windows 8 Metro UI

    - How To Add Widgets To Windows 8 Lock Screen
    programming4us programming4us
    programming4us
     
     
    programming4us