|19 May 2009||#1|
Windows 7 Managed Code APIs
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:
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 ranges
Range from 0 to 16, script Latn
Range 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:
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.
|My System Specs|
|Similar help and support threads|
It seems I've managed to cripple my Windows 7 Ultimate!
A few weeks ago I decided to do a clean install of a new (to me, anyway) version of Adobe Photoshop (I actually had two prior versions of Photoshop on my hard drive, so starting with the oldest one, I used "Revo Uninstaller" to remove them) I've used "Revo" for years because after it uses a...
Windows APIs: Microsoft's hidden guide to architecture
Read more at source: Windows APIs: Microsoft's hidden guide to architecture | ZDNet
Windows Firewall ( Managed By Vendor Application McAfee Personal FW)
Recently i bought a new laptop Windows 7 professional 64 bit and it came pre-installed with McAfee Internet Security Suite. I seem to be experiencing problems with my firewall settings as i access the windows firewall windows.Please see link below for my window firewall snapshot Pictures by Thabss...
Windows 7 Libraries – Managed Code
Windows 7: UAC whitelist. Secret APIs again. A lawsuit waiting to happen?
Windows 7: UAC whitelist. Secret APIs again. A lawsuit waiting to happen? This is message written by a mod at the unofficial forum for Directory Opus, a 3rd party Windows file manager. It's a interesting little read, especially since I am a Directory Opus user myself :huh:
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
All times are GMT -5. The time now is 20:04.