Search Wiki:
Resource Page Description
The Windows® API Code Pack for Microsoft® .NET Framework provides source code library to access new Window 7 feature (and some related Vista features) from managed code. These features are not available to developers today in .NET Framework.

The features included in this alpha (0.8) version of the library are:
  • Support for Windows Shell namespace objects, including the new Windows 7 libraries, Known Folders and non file system containers.
  • Vista and Windows 7 Task Dialogs.
  • Windows 7 Explorer Browser Control supporting both for WPF and Windows Forms.
  • Support for Shell property system.
  • Helpers for Windows 7 Taskbar Jumplists, Icon Overlay and Progress bar.
  • Support for Vista and Windows 7 common file dialogs, including custom file dialog controls.

*Minimum .NET Framework version required to use this library is 3.5.
*This library targets the Windows 7 Beta version, though some of the features will work on the older versions of Windows operating system.

To build the library in Visual Studio 2008, please extract the contents of the ‘’ file in a new folder, open the included ‘WindowsAPICodePack.sln’ file and build it.

The library also contains sample applications built using this library. It also contains help file WindowsAPICodePack.chm.

Please note that this library is currently a work-in-progress and current version is the alpha release (version 0.8) of this library. The final version of this library will be available around the time of Widows 7 RTM release. Various features in the library could change between now and final release.

**Delete the following note before publishing **

This resource page is currently in setup mode and only available to coordinators and developers. Once you have finished setting up your resource page you can publish it to make it available to all MSDN Code Gallery visitors.

To get your Resource Page ready to publish, you should do the following:
  1. Make any changes to the details of your resource page
    1. Here you can enable or disable functions of your resource page. You might want to turn on the Issue Tracker to allow users to provide feedback on your resource, or if you have a resource that does not involve a code sample, you may want to turn off the Releases tab.
    2. Make sure your resource page description is detailed enough to let people search for your resource.
  2. Add your code sample or other resources to the resource page
    1. If you’re uploading code, go to the Releases tab and create a new release to house your code. Creating a release allows you to have the license properly displayed when people download your code, as well as provides a download count.
    2. Edit your Wiki page to attach any resources you may have that are not source code.
  3. If you want to let someone see your resource page before it is published, go to the People tab and add them to your resource page
    1. This will let you add other team members who may be contributing to your resource, or just show it off and get feedback from someone you trust.
  4. Tag your resource page with descriptive tags to make it easier for people to find your resources when browsing the gallery.
  5. Publish your resource page so it becomes visible to everyone!

Additional information on starting a new resource page is available here: Resource Page Startup Guide.
Last edited Apr 19 2009 at 8:51 AM  by sumitmsft, version 3
SBussinger wrote  May 1 2009 at 11:35 PM  
Thanks for putting this up! I'd love to see you write some support for the new Windows 7 API for the Windows Biometric Framework.

onoj wrote  May 8 2009 at 6:15 PM  
hi SBussinger. Check out Dan Griffins biometric sample for info on how to call the Biometrics Framework:

Octavio wrote  May 10 2009 at 7:31 AM  
Does this release include (or will include) support for multi-touch features?

sumitmsft wrote  May 14 2009 at 10:18 PM  
Multi-touch features are not likely to be included in this release of Windows API CodePack.

sandit27 wrote  May 19 2009 at 11:43 AM  
Thanks for this release..

wayne_p wrote  May 24 2009 at 12:33 AM  
Will these become a part of .NET Framework 4.0? If not, at what point will they be added?

RichardDeeming wrote  May 26 2009 at 1:52 PM  
It would be nice if the documentation included information about the minimum supported version of Windows for each feature, and some idea of how the API will fail on an unsupported platform.

mfc_97 wrote  May 27 2009 at 7:47 AM  
Thanks for this effort! Are we going to see the new DirectX features, d2d and direct text ?

xyzzer wrote  Jun 12 2009 at 3:44 PM  
D2D 1.0 and DirectWrite support are there in the new release!

devDept wrote  Jun 23 2009 at 10:07 AM  
Does this mean we can use Direct3D with managed code? As we did with DirectX 9 and Managed Direct3D? Thanks.

xyzzer wrote  Jun 24 2009 at 2:39 PM  

RyGuy12 wrote  Jul 1 2009 at 9:56 PM  
Will we ever get support for the Ribbon?

cjmarsh wrote  Jul 8 2009 at 10:35 AM  
Hi there - will there be support for the Mobile Broadband API at some point?

REVAN wrote  Jul 10 2009 at 8:19 PM  
Thanks for nice Lib. I'm interesting about support of D3DX general and D3DX Math. And, like a RyGuy12, what about Ribbon?

sumitmsft wrote  Jul 10 2009 at 9:49 PM  
RyGuy12 - The V1.0 release of the Code Pack will not have support for Ribbon. We are considering this feature for future versions.

cjmarsh - Thanks for the feature request. We will add Mobile Broadband API support to the list of potential candidates for future releases.

REVAN - We do not have full support for D3DX but we have basic Math and utilities library that we have used to build our samples. In addition, the included DirectX utilities (in Samples) show how to wrap D3DX interfaces and methods.

Christianhood wrote  Jul 14 2009 at 5:08 PM  
Same question as wayne_p:
"Will these become a part of .NET Framework 4.0? If not, at what point will they be added?"

xyzzer wrote  Jul 15 2009 at 4:48 PM  
I wouldn't say it could be included there - the Beta version does not include it, so why the released version would? Anyway - why would you like it included there? Isn't it better to just have the source code that you can bend to your needs easily?

MikeH wrote  Jul 25 2009 at 8:03 AM  
@cjmarsh - There is already a whitepaper on using Mobile Broadband API with managed code at

Shemmie wrote  Aug 9 2009 at 5:40 PM  
May I just add - that this could be the greatest single thing Micrsoft could have done to drive Vista / Windows 7 adoption. Core API's moved to managed code - it's like my birthday come early. Thank you.

DimitarCC wrote  Aug 11 2009 at 5:44 AM  
Thanks for that API! I will start using it right now to code applications compatible with Windows 7.

Timbot wrote  Aug 11 2009 at 1:40 PM  
i'm just curious (and i've seen a few others) if there's something like this for windows xp that anyone knows about? we're kind of stuck on it here at work...

ThomasLebrun wrote  Aug 19 2009 at 10:11 AM  
For those who want to use biometric features from Windows 7, you could take a look here:

REVAN wrote  Aug 19 2009 at 3:15 PM  
Is there are any plans for Media Foundation wraper in next releases?

rctaubert wrote  Aug 25 2009 at 11:33 PM  
I have taken the sample for the Shell PropertyEdit Sample, rewrote it for a form app and it works great on Vista. Is there a way to get it to work on an XP computer????

I have installed Framework 3.5 sp1 on the XP machine and the program will run without exceptions.

The program contains four function:
1. Get property value
2. Set property value
3. Enumerate properties and values.
4. Give information about a specific property name.

On the XP computer the program will run without errors but only function #4 will return a value.

I hope their is just something I am missing.

sevenalive wrote  Aug 26 2009 at 7:57 AM  
Please drop the WinForms Dependencies. if you want everyone to use WPF then stop using WinForms. For the next release you should split more code into the "Core" library and then have WPF library and a WinForms library.

BillGatesII wrote  Aug 26 2009 at 3:52 PM  
THANK YOU! this is so much easier then having to look around the web for something.
I'm just woundering, is there any thing for the new VHD API in this?

CElliott wrote  Aug 29 2009 at 11:56 PM  
The newer Intel CPUs have a built-in floating point operations counter. Will Windows 7 provide an interface to this counter? In other words, will it be possible to call something like QueryPerformanceCounter() to access the FLOPs that a program has executed?

Keeron wrote  Aug 30 2009 at 1:06 AM  
@CElliott: Looks like the APIs are already there and easily callable from .NET (using pinvoke):

PInvoke: (only couple; I am sure you'll find others on


DeniseMToronto wrote  Oct 5 2009 at 12:48 AM  
I can only assume most of the installation instructions have been left out. They didn't even say to use C#. C# couldn't find the files in the locations the ZIP folder put them. The supposedly VB samples are looking for C files! Microsoft, how about some instructions on how to actually install and use these!

Keeron wrote  Oct 9 2009 at 2:20 AM  
There is nothing to "install" ... It's a zip file with sources and samples. Download the file, unzip, run the samples SLN files.

xyzzer wrote  Oct 9 2009 at 5:42 AM  
Well, of course you need a few things, like .NET 3.5, Visual Studio seems pretty useful, so is a C# or VB compiler and C++ for DirectX, Windows SDK and DirectX SDK. I suppose C++ was missed from the list, but really everything else is mentioned above.

arikp wrote  Oct 12 2009 at 8:09 AM  
Check Windows Ribbon for WinForms at [url:]
This is my work for provding .NET WinForms users access to the ribbon feature.
It is build on top of Windows API Code Pack and tries to follow the same convensions.
Sample projects included.

HappyBunny wrote  Oct 15 2009 at 8:17 AM  
Is there any plan to include the WINSCARD functions in a later release?

jcdickinson wrote  Nov 4 2009 at 8:56 AM  
DirectCompute would be a nifty one. It would be great to be able to speed up math-heavy .Net apps without having to resort to unmanaged code.

robertgraziano wrote  Nov 5 2009 at 3:08 PM  
Shouldn't this be rolled into a .NET Framework release/update? It'll make it easier to roll out the runtimes to servers/workstations. Nice features, by the way. As someone else pointed out, DirectCompute would be nice...

xyzzer wrote  Nov 21 2009 at 8:40 PM  
Awesome! Can't wait to play with it!

thwart wrote  Nov 25 2009 at 12:01 AM  
So does this mean the Microsoft supports access to DirectX with Managed code? How is this different from Managed DirectX? What does this mean for XNA? Can I assume that XNA is what Microsoft is still pushing for Indy game development?

thwart wrote  Nov 25 2009 at 12:02 AM  
This is great news for tool development. By that I mean access to DirectX through Managed code.

Zyphrax wrote  Dec 9 2009 at 1:09 PM  
Why did you choose a minimum of .NET 3.5 SP1? If you could lower that to 3.0 or even 2.0 a lot more people would start using it. Great set of tools though, I think they should be part of the framework, nice WPF controls.

felizk wrote  Dec 13 2009 at 11:42 PM  
Is there any plan to add an API for controlling the Desktop Wallpaper Slideshow?

arikp wrote  Dec 22 2009 at 11:06 PM  
I'm proud to present [url:Windows Ribbon for WinForms|],
a library for using windows ribbon in WinForms applications.
It is a managed wrapper around the Windows Ribbon Framework (formerly known as Scenic Ribbon)
and includes all the ribbon features supported by the framework.
The [url:documentation|]
shows how to use every feature from a WinForms application.
Also, the project site contains 18 sample applications that showcase every feature along with the full source code of the wrapper library.

Bokonon wrote  Jan 5 2010 at 10:26 PM  
As others have suggested, this is a great set of tools, but many of us out here in the "real world" are still working with .NET 2.0, so your decision to require .NET 3.5 SP1 is very, very disappointing. Why should I have to force all of my users to upgrade to .NET 3.5 SP1 just so that those of them who run Windows 7 can have a measly jump list with custom tasks? Is that too much to ask?

sevenalive wrote  Jan 11 2010 at 10:41 PM  
@bokonon, You could strip out what you need or even remove the incompatible code and reduce the .net framework. Most people have at least 3.0 if not 3.5 sp1. Once you get the framework installed, windows update auto updates that version. Vista has 3.0 built in, Windows 7 has 3.5 sp1 built in. So the only real problem would be XP users, and imo that isn't going to be a issue in about 1-2 years. Try to see if it runs the 3.5 client profile.

BTW, the 4.0 client profile, is a huge improvement and 4.0 is coming around the corner. My apps require 3.5 for the linq and other efficiencies and it hasn't been a problem for my userbase.

Piklets wrote  Jan 19 2010 at 11:02 AM  
How are we supposed to use this with Visual Basic? Instead of C# that is...

REVAN wrote  Jan 25 2010 at 12:29 PM  
Have any plan to multi targeting for frameworks? Net 4.0 can't using dll without recompile and 2.0 version will be nice for mainstream. And why no support of media foundation in interop maner for example?

general wrote  Jan 31 2010 at 3:42 PM  
If you are using .Net 2.0 you can on startup check if current user uses Windows 7, and then invoke CodePack's methods via Reflection. You have to add compiled dlls like Microsoft.WindowsAPICodePack.dll into your .Net 2.0 output directory. If user uses Win7, load this assembly using Assembly.Load("Microsoft.WindowsAPICodePack") and then invoke all needed methods.

Using Reflection provides no need to reference CodePack's .Net 3.5 dlls into your .Net 2.0 project. This is dirty method, but effective and simpler than using native calls to Windows API.

IMPORTATNT: You can also create a .Net 3.5 project that uses CodePack and initializes all needed things (like JumpLists). This project could contain only one class (eg. Win7Initializer) with one method (eg. void Win7Initializer.Initialize()). This method has to initialize Win7 features. Compile it into eg. Win7Initializer.dll. Then in your .Net 2.0 project check if user uses Win7 and then use reflection to load Win7Initializer.dll and call only ONE method: Win7Initializer.Initialize. Simple?

REVAN wrote  Feb 24 2010 at 11:50 AM  
Just found pure managed GXDI library [url:] it doesn have problems with X64.

xyzzer wrote  Mar 31 2010 at 6:25 AM  
Congrats on another 60k downloads! :)
Just wondering... would this run on a Surface? I am tempted to try...

sevenalive wrote  Jun 9 2010 at 1:18 AM  
If your developing on .Net 4, then you really don't need this codepack if you just want Win7 feaures. However I need it for a vista/7 dialog in .Net still.

Schbodz wrote  Aug 7 2010 at 9:34 PM  
Is rerealsing code taken from the api pack under the Ms-PL covered by the custom license attached to this a legal action?

lazlolussierbonin wrote  Oct 13 2010 at 10:07 PM  
Can't extract the pack. I see the progress bar for half a second then nothing.

AbstractViews wrote  Oct 19 2010 at 11:07 AM  
I would like to receive an e-mail contact for looking at further samples on the Windows API CodePack, which contains simple examples of PIDL's, or ITEMIDLISTS, which are quite well-documented on the samples and documentation with simple examples of what you need to do to create an IntPtr to a file, but do not show code for writing a pidl from a higher level as a file although the conversion of an IShellItem to an IntPtr pidl is quite obvious.
The codepack is a good start, but where to do I need to look to find more about IShellItem and IShellItem2 as well as ShellObject, ShellContainer and ShellFolder. The current searches I have done on Bing and MSDN do not give the one line of code that explains a pidl or a line of code that explains say a cut and paste or a drag and drop in detail. I am currently trying to write this functionality in an application as a combination of the ExplorerControl on WindowsAPICodePack and a combination of a TreeView and a ListView.
I have tried the easy samples on the CodePack such as the ExplorerBrowser, which enable writing an ExplorerBrowser control in a window, but cannot see how to access the ListView or the TreeView in code from the ExplorerBrowserControl property since there is no Property, method or member variable that can gain access to the treeview or listview apart from Navigate in the ExplorerBrowserControl. Is there a property or method or interface that can directly access the TreeView , ListView in the control.

tronda wrote  Oct 22 2010 at 8:23 AM  
Wonder if some in the team could shed some light on this issue:

squan888 wrote  Nov 30 2010 at 3:57 AM  
To migrate the Controls project to Visual Studio 2010 the Target Name needs to be changed from $(ProjectName) to Microsoft.WindowsAPICodePack.DirectX.$(ProjectName).

squan888 wrote  Nov 30 2010 at 3:58 AM  
To migrate DirectX.vcproj to Visual Studio 2010 the project file has be changed from being saved as UTF-8 to being saved as ANSI. Use Notepad to do this.

yzorg wrote  Feb 20 2011 at 5:45 AM  
Someone created a nuget package for this code pack but used 1.0 instead of the latest 1.1. 1.0 is missing many APIs including WPF Explorer Browser (IIUC). The owner of Windows Code Pack should contact the nuget maintainers (David Ebbo @ ms, Phil Haack) to get the package updated.

guercheLE wrote  Mar 3 2011 at 7:36 PM  
I am intending to create a small system tray application to let me shuffle themes (not background images only) from time to time (every 5 hours) and I am wondering if it is possible to achieve what I want just using "Windows® API Code Pack for Microsoft® .NET Framework" and managed code.

beth62 wrote  Apr 22 2011 at 5:12 PM  
The link above for the Explorer Browser video is dead:

Kevininstructor wrote  Jun 5 2011 at 2:06 AM  
Using VS2008 on Vista I tried the VB.NET project AppRestartRecovery. Ran the project, opened a simple text file, waited over 60 seconds then crashed the app. I watched all debug messages using DBWin32 and all appeared to work as excepted but the app did not restart. Any ideas why it would fail to restart?

JacobPitts wrote  Aug 19 2011 at 9:26 PM  
Two broken links on this page:
Explorer Browser
Common File Dialog

BiggestWave wrote  Sep 8 2011 at 12:34 PM  
The above mentioned links to Explorer are *still* broken!

sevenalive wrote  Sep 13 2011 at 4:38 AM  
In TaskDialog.cs this is an artifical limitation. I commented out the exception and never had a problem having a custom default button and a standard cancel button. Might want to review some of these check's because this wasn't the only one I found like this.

//if (buttons.Count > 0 && standardButtons != TaskDialogStandardButtons.None)
// throw new NotSupportedException(Properties.Resources.TaskDialogSupportedButtonsAndButtons);

You can have custom and standard buttons in the same taskdialog, even the MSDN examples say you can, not sure why whoever did this thought different.

alun wrote  Oct 31 2011 at 12:36 AM  
A couple of things I would like to see in the PropertySystem code:
1. System.RecordedTV.OriginalBroadcastDate seems to fail every time I set it on an MP4 file, and does not read correctly out of MP4 files that have been edited by the Zune software to have a broadcast date. [I have sample code if you want to play with this]
2. I would really like to see IStream support to allow me to set ThumbnailStream on MP3 and MP4 files. Is that at all possible for the future?

LordHog wrote  Nov 8 2011 at 11:06 PM  
Has this project been abandoned?

mike6518 wrote  Nov 30 2011 at 7:33 PM  
Will there be any new release? Thanks.

ronaldhorn wrote  Apr 13 2012 at 3:48 PM  
Is this still being supported? Will the binaries work on Windows 2003 server?

mdavidjohnson wrote  Jun 2 2012 at 8:42 PM  
The blog links on this page appear to be broken.

Page view tracker