Excited about Windows 7 and would like to use new features from your managed application, but do not have a convenient way to do that? Always wanted to use many of the useful features from Windows Vista or older versions of Windows but could not do so because they were not available via .NET Framework?

There is help available now for some of your needs. Perhaps, you are already aware of Windows® API Code Pack for Microsoft® .NET Framework and have tried the version 0.85 or 0.80. We have just released the version 0.90 of this Code Pack. For people reading about it for the first time, Windows API Code Pack is a source code library to support targeting some new Windows 7 features and some other features existing in older versions of Windows from managed code. These features are not available via .NET Framework Class Library today. Using Windows API Code Pack you can target many of these useful Windows features without having to write interop code yourself. If this sounds familiar to VistaBridge, that is because the Windows API Code Pack evolved from it.

The Window API Code Pack includes a complete source code library, sample applications and API reference documents. You can build the included solution files to get the assemblies for use in your applications (pursuant to the attached license). And since the source code is available to you, it can be modified to extend functionality as needed.

We will discuss individual feature areas of the Windows API Code Pack in detail in subsequent posts; this post is intended to provide a brief overview of various feature areas.

Shell (including Windows 7 Libraries) – Windows Shell APIs provide a rich set of COM interfaces and functions for developers to interact with Shell. But managed developer cannot easily access these APIs unless they write their own interop layer. Shell related features in the Code Pack enable managed developers to access many of the vast resources of Windows Shell APIs in a standard .NET friendly way.

  • The Code Pack provides an overall hierarchy of various Shell entities like ShellItems, ShellLinks, Files, Folders, Known Folders, Windows 7 Libraries, non-file system containers, Shell icons, Thumbnails, Saved searches, Network Drives etc. Using the Code Pack APIs, you can easily traverse the Shell Namespace objects and perform the needed operations.
  • It also provides easy access to the Shell Property System. Developers can get or set the properties of various Shell objects they need from managed code.
  • An Explorer Browser control is included to allow developers to add a Windows Explorer lookalike inside their managed application.
  • Developers can easily use the latest features of Common File Open and Save Dialogs including custom controls in their applications. The TaskDialogs introduced in Vista is also available.
  • It includes rich thumbnail/icon support integrated with the Shell objects.

Since pictures are worth a thousand words, screen shots of some of the sample applications (included in the Code Pack) eloquently demonstrate the capabilities of the above features

  • Shell Hierarchy Tree Demo application shows how to traverse the Shell namespace starting with the Desktop object

image

  • ShellObject Browser demonstrates the integration of Common File Dialogs and various ShellObject types.

image

  • Star Backup using Libraries mimics a backup application that takes advantage of the new Windows 7 Shell Libraries.

image

  • Known Folders Browser displays all the Known Folders present in the system and show various properties for each folder. The application also uses ExplorerBrowser control to display the known folders

image

 Windows 7 Taskbar – Taskbar features of the Windows API Code Pack provide convenient access to the new Taskbar functionality

  • Management of tasks and items in Jump Lists
  • Displaying icon overlays on the Taskbar button to convey state of the application
  • Displaying progress bar on the Taskbar button to show the status of time taking operations
  • Displaying Tabbed thumbnails for MDI and TDI applications
  • Ability to add Thumbnail Toolbar for most frequently used commands.

Screen shots of some of the sample applications (included in the Code Pack) demonstrating the above features

  • This sample application shows the management of jump lists in an application, progress bar and usage of Taskbar overlay icons

image

image

  • This sample application shows the Tabbed thumbnail and Thumbnail Toolbar features

image

  • The screen shot below shows an image viewer application with thumbnail toolbar exposing important commands.

image

DirectX Technologies – The DirectX features of Windows API Code Pack expose a wide range of Windows graphics APIs to managed developers. Many of these are new to Windows 7.

  • Direct3D 11.0, Direct3D 10.1/10.0 features can be used to add 3D graphics to your managed applications.
  • Direct 2D feature allow you to access powerful new 2D graphics APIs in your applications.
  • DirectWrite feature expose parts of the new text rendering APIs
  • Windows Imaging Component (WIC) feature makes working with images and image data convenient by exposing some WIC APIs.
  • Also included are some utilities for Math computations, texture loading etc.

Screen shot of a ‘Paint’ like sample application built using these features showcases some of the capabilities of the Code Pack.

image

Screen shot of another application showcasing the advanced texture and mesh features of Direct3D, WIC managed APIs and some utilities

image

Sensor Platform APIs - The Sensor feature of the Code Pack gives developers access to the new Sensor Platform APIs from managed code. Windows 7 has introduced standardized support for physical sensors, such as accelerometers and ambient light sensors. A developer can use the Code Pack to collect data reports from sensors attached to the computer and process changes received in the sensor data reports.

Screen shots of sample applications demonstrating use of accelerometer and ambient light sensor data.

image

image

Extended Linguistics Services (ELS) APIs – ELS APIs are new to Windows 7. ELS feature of the Code pack provides managed developers the ability to detect the script or language being used and adjust the user experience accordingly.

Power Management – provides managed code access to power settings and notifications for related changes.

Screen shot of the sample application that demonstrates the use of power management related APIs

image

Application Restart and Recovery – lets a managed application save data and state information before an application exits because of an unhandled exception.

The screen shot of a sample application below demonstrates this feature. In the event of an application crash, the library allows the application to recover its data and when restarted by the system, it can load the previously saved data

image

  • Network List Manager APIs – provides managed code access to network details
  • Managed code access to Command Link control and System defined Shell Icons

There are many other samples (available both in C# and VB.NET in some areas) included in the Code Pack. Please download and play with the Windows API code pack and samples to explore its full potential. We are currently working on fixing bugs and preparing for the final update around the Windows 7 RTM release. Please let us know if you find any issues or have any suggestions, by using the Discussions or Issues tab and help us make the Windows API Code Pack better.

More detailed post on different feature areas coming soon.

Sumit Kumar

Program Manager, Windows SDK Team