Many of you don’t know about the Vista Bridge sample library, what can it do or even where you can find it.

Let’s start with the basics; i.e. definitions. Vista Bridge is a sample library that contains managed wrappers for a number of Windows Vista APIs that are not exposed in the .NET Framework. The wrappers include common Open and Save file dialogs and new Vista advanced task dialogs.

So, where to download it?

There are three ways to obtain the sample library.  It’s included in both the Windows SDK for Windows Vista Update and in the newer Window SDK for Windows Server 2008 and .Net Framework 3.5; or a third option is to download the Vista Bridge sample library which is part of the Windows SDK Cross Technology samples.  I recommend downloading the Windows SDK for Windows Server 2008 and .Net Framework 3.5, but if you don’t have the network bandwidth or just want the samples, then the last option should be the most suitable.

You can find the samples in the Windows SDK in two locations: embedded in the .NET Framework documentation or in a .zip file under Windows SDK samples installation folder. 

Inside the SDK documentation

The Vista Bridge sample library in the documentation has its own description page that can be found by searching on “Vista Bridge”. From this sample page, you can view the source files for the samples as well as download all or some of the files of that sample to a chosen location.

Windows SDK samples installation folder

The Vista Bridge samples library is also included in a .zip file containing all of the Cross Technology samples.   These can be accessed by directly opening the sample .zip files which installs by default to <install folder>\Samples\CrossTechnologySamples.zip, or by extracting the zip file content to the hard drive. Either way, the sample library is under the VistaBridge subfolder.

If you install Windows SDK, you’ll need to make sure to select the correct components during SDK setup to get the samples.  These components are selected by default, so a default install will have them.  To get the samples inside the documentation, you’ll need to select the Documentation/.NET Framework component option installing the SDK.  To get the samples in .zip file format, you should select the Samples/.NET Framework/Samples in .ZIP file component.

vistaBridge samples

After downloading/installing, you can open the solution file (VistaBridge.sln) in Visual Studio 2005 or Visual Studio 2008. It won’t matter if you use the Express or a commercial edition. If you use VS 2008 however, you’ll be asked to upgrade the solution. This is perfectly safe and will not change any parts of the project.

Current bugs in Vista Bridge

As with any other software, Vista Bridge does have some bugs. Two of those that you’ll need to resolve:

  1. You won’t be able to open the Windows1.xaml in the Xaml designer. You’ll get this error: (Loading problem, document contains errors that must be corrected ...). A description of the problem and a fix are posted here: http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3908575&SiteID=1
  2. Another more severe bug is that some of the demos will not work (throwing exceptions) because a correct manifest is not specified. An application manifest is required to find the entry points in the commdlg32.dll.The same post above details the steps necessary to fix the problem.  I’m copying both posts again here in case the link is not working:

... There is a problem opening Windows1.xaml.  The problem was caused by some of the elements in the Xaml page not inheriting from a control, so to fix the problem we need to do the following:

- In the “VistaBridgeLibrary” project, open DialogControl class

- Modify the class so that inherits from System.Windows.Controls.UserControl

- Because both Equals() and GetHashCode() are sealed in UserControl, we need to comment both methods at the bottom of the class

- Now, rebuild the solution and the Xaml page should be displayed correctly

Also, in order for the demo to run correctly, we need to select the correct manifest – this is required to find the correct entry points in the dlls:

- Right click on “VistaBridgeDemoApp” project and select Properties

- In the Application tab, go down to the “Manifest:” ComboBox and select “Vista BridgeDemoApp.exe.manifest” from the drop down

- Now, rebuild and run the application. All demos should run correctly now.

After fixing both problems you should be able to work freely with the various demos provided by Vista Bridge. Of course, the Windows SDK team is working in extending the sample library, so expect more of it in future releases of the Windows SDK.

Mahoud Saleh
Software Development Engineer, Windows SDK Team

The MSDN Windows SDK Developer Center is the place to find resources and links to Windows SDK products, release notes, technical articles, and more.