We have enabled an easy direct access to Windows 7 (and some Windows Vista) features for .NET developers. All you need to do is download Windows API Code Pack today!
As mentioned in the Windows 7 .NET Interop Sample Libraries post, most Windows 7 APIs are written in native code C, C++, and COM APIs, and have no .Net equivalents. This makes the life of managed code developers a bit hard, forcing them to create their own interoperability layers for communicating between .NET and the native Windows APIs. Some native APIs are easy to wrap and use from managed code, requiring simple interoperability efforts like adding a reference to a COM type library. However, some are extremely problematic and require a lot of knowledge about the “Win32” programming style. That is exactly why the Windows API Code Pack for Microsoft .NET Framework was created.
In the Windows 7 .NET Interop Sample Libraries post, we highlighted few samples codes showing how to access the Taskbar, Libraries, Sensor, and multi-touch from .NET, and we also promised to report in the near future on a new project, Windows API Code Pack for Microsoft .NET Framework. The Windows SDK team built the Windows API Code Pack to provide easy access to Windows 7 features for .NET developers , lowering the bar for developers who want to target Windows 7 Client applications. Basically, it is the closest thing a .NET developer will have to managed code APIs for Windows 7.
The Windows API Code Pack (Code Pack) is much larger in terms of offered functionality and quality than its older brother, the Windows Vista Bridge. The Code Pack contains a wide variety of APIs, including very comprehensive Windows Shell namespace objects, Windows Taskbar, Libraries, and Windows 7 Extended Linguistic Services. The following is a short list of the APIs contained in the Windows API Code Pack:
When you download and unzip the v0.85 file, you will find a Samples folder. This folder contains number of samples demonstrating the entire range of APIs provided by the API Code Pack. You will also find the WindowsAPICodePack folder that contains the full source code for this library. This provides a great interoperability learning opportunity, while giving you the full flexibility of changing source code.
There are many samples, 13 for now with more coming in future releases, but there are four in particular that I want to highlight.
WPF Explorer Browser Demo
Before going into details about this demo, let’s talk about the Windows Shell. The Windows Shell is the main area of user interaction in Windows. Many users refer to the Windows Explorer as “Windows”; however, it is just one part of the overall Windows Shell. The shell includes many other UI elements, such as the Taskbar, the Start Menu, Windows Explorer windows, the Recycle Bin, and search results. The most common and well known shell objects are files and folders. However, there are many other virtual objects such as the Recycle Bin, printers, Libraries, etc. Shell objects are organized into a hierarchical namespace that encompasses the file system namespace.
With a proper understanding of the Shell namespace, and access to the topmost Shell Object, the Desktop, you can traverse the entire computer, including files and folders, as well as printers, fonts, Program files, and Recorded TV. By using the Shell namespace, developers can access all the files and folders and all the Known Folders (which we briefly mentioned in the Libraries Under the Hood post) in a given computer.
Up until now, this was blocked from .Net developers; however, the new Code Pack provides an Explorer Browser control as well as well the defined objects, structs, and APIs needed to traverse the Shell namespace. In the Shell part of the Code Pack (Shell project), you can find Explorer Browser controls for WPF and WinForms, as well as all the functionality needed to work with Known Folders, and a wide range of Shell objects (under the Common folder) such as ShellObject, ShellLink, ShellFolder, ShellItem, ShellCollection, ShellThumbnail, and the list continues. The Taskbar and Libraries implementation also uses many of these shell objects. As shown in the following picture, the Explorer Browser demo spotlights the Explorer Browser control that can help visualize the Shell namespace.
Similarly, Shell Hierarchy Tree Demo, shows how you can traverse the entire computer contents using the Shell namespace starting from the topmost Desktop objects:
The Code Pack also contains Sensor APIs for the Windows 7 Sensor and Location platform. The Sensor project contains all the necessary definitions to work with Sensors including a SensorManager to get sensors, and a Sensor class to work with sensors, and of course a SensorReport that allows you to access the sensor data. The Sensor demos include two demos illustrating two sensors, Light and Motion. You can use the Virtual Light Sensor from Win 7 RC SDK to simulate different lighting conditions, and the very simple Ambient Light Level application to display a visual representation of the total amount of light detected by the light sensor.
Extended Linguistic Services Demo
Extended Linguistic Services (ELS) is another very interesting technology available in Windows 7. ELS is a new feature in Windows 7 that allows developers to use the same small set of APIs to leverage a variety of advanced linguistic functions. By using ELS APIs in Windows 7, developers can auto-detect the language of any piece of Unicode text and use that information to make smarter user experience choices for customers around the world. The ELS platform is the interface between your application and ELS services. It provides a simple way to leverage several kinds of linguistic functionality through the same API, which allows the application to access and use specific services. For more information about the API, see Extended Linguistic Services Reference.
By using the MappingAvailableServices class you can query a given string for the language in which the string is written. This allows you to either verify the language in which a string is written or ask in what language a string is written. This can be a very powerful tool for multi-language application developers.
And it is easy to use. For example, the following line of code tries to detect what languages are used in the string:
scriptDetection.RecognizeText("This is English. АБВГД.", null))
The output will be something like:
Recognized 2 script rangesRange from 0 to 16, script LatnRange from 17 to 22, script Cyrl
Taskbar and Libraries
The Code Pack provides the required APIs to program against the Taskbar and Libraries in Windows 7. For the Taskbar you can:
At this stage of the development, you cannot Control Custom Thumbnail Preview, and custom Preview, also known as AeroPeek. To have this functionality, you will need to use the Windows 7 Taskbar Sample .NET Interop Library.
With the Taskbar demo, you can learn how to have full control over your Jump List as shown in the next image:
The Code Pack also provides full support for Windows 7 Libraries, which we will talk about extensively in the next post.
Please note that this library is currently a work-in-progress and this is version 0.85 of this library. The final version of this library will be available around the time of the Windows 7 RTM release. Please help us improve by downloading the source code and sample, and using them in your applications. Please report bugs or any other comments and ideas you might have using the Discussion, and Issue Tracker.
Check out the new version of the code pack at code.msdn.microsoft.com/WindowsAPICodePack
Check out the new version at
[suggestion #10] bootscreen delete "Starting Windows" text for other language
If you use Japanese / Chinese / Korean / Thai / Other Language.
In FULLSCREEN look bootscreen, the other language "Starting Windows" text very big, very ugly.
bootscreen remove "Starting Windows" text for other language
[suggestion #11] Windows Journal update to Ribbon-based UI
Bill Gates say: We'll Use the Ribbon/Fluent User Interface across Windows 7.
But why only the Paint and WordPad?
He forget Windows Journal and some application.
Windows Journal update to Ribbon-based UI
[suggestion #12] Windows PowerShell ISE update to Ribbon-based UI
He forget Windows PowerShell ISE and some application.
Windows PowerShell ISE update to Ribbon-based UI
[suggestion #13] Windows Photo Viewer support GIF, MNG format
1. Windows Photo Viewer can't open .GIF, MNG, APNG format
2. IE8 can't open MNG, APNG format
[suggestion #1] keep Menu color layout consistency for Windows 7
to improve Appliaction Menu color. (discriminated Appliaction Menu color very difficult, looked vague.)
There is no consistency between the Start Menu and the Appliaction Menu.
To keep Start Menu and Appliaction Menu color style consistency, like Windows XP.
Windiows Explorer Menu has 2 color layout styles in Windows7.
Please keep color layout consistency for Menu.
Why the 'Include in libary' used another color layout?
keep Menu color layout consistency for Windows 7
[suggestion #2] keep Details Columns style consistency for Windows 7
Details Columns has 2 styles in Windows7.
Please keep style consistency for Details Columns.
keep Details Columns style consistency
[suggestion #3] keep UI theme style consistency for Windows 7
keep UI theme style consistency for Menu bar & Tool bar.
like Windows XP theme style's consistency.
keep UI theme style consistency for Windows 7.
[suggestion #4] improve color layout for currently using task icon
Taskbar color layout too bad.
If you using light color desktop background, you will don't know what is the using task icon.
Its brightness too high, so looks too blurred when light color desktop background.
Currently using task icon is recognize hard when light color desktop background.
improve color layout for currently using task icon