Coolthing Of Theday

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 28 October 2013

Toward Metadata Mastery with the Windows API Code Pack

Posted on 17:42 by Unknown

DZone - Rob Sanders - Extracting File Metadata with C# and the .NET Framework

Introduction

Over the weekend, I decided to try and import image metadata using C# and the .NET Framework.  Aside from “normal” file attributes such as date modified and size, the Windows Explorer (shell) provides extended file property information which can be quite valuable.

The challenge was how to extract this information, given that the .NET Framework has somewhat limited support for this type of extraction?  Read on to find out how.

...

Therefore you can obtain more information like this by using Win32 interop and invoking shell calls directly from C#/.NET, but this can be time consuming, not to mention laborious as you have to track down the correct Win32 API interfaces and property item IDs to use.  Surely there’s an easier way?

Introducing the Windows API Code Pack

Thankfully, someone has already done the leg work for us, and it has culminated in the extremely useful Windows API Code Pack, the latest release being available via this link.

The Pack itself contains documentation, samples, pre-compiled binaries and the source code for the binaries.

Honestly, I found the documentation and samples to be a bit underwhelming, but the core assemblies are absolutely gold – once you figure out how to use them properly.  The following is a screenshot of the Explorer Browser which ships as a sample with the Pack:

...

Retrieving Extended Property Data

One of the best features of the Pack must be the fact that someone has gone and mapped all the extended property values to strongly typed definitions, which saves us a lot of time and effort.

...

The SystemProperties class defines an incredibly useful hierarchy of extended property identifiers which can be used in conjunction with shell objects, as demonstrated above

image

What is this Windows API Code Pack thing?

Windows® API Code Pack for Microsoft® .NET Framework

Windows® API Code Pack for Microsoft® .NET Framework provides a source code library that can be used to access some features of Windows 7 and Windows Vista from managed code. These Windows features are not available to developers today in the .NET Framework.
The individual features supported in this version (v1.1) of the library are:

  • Windows 7 Taskbar
    • Jump Lists, Icon Overlay, Progress Bar, Tabbed Thumbnails, and Thumbnail Toolbars
  • Windows Shell
    • Windows 7 Libraries
    • Windows Shell Search API support
    • Explorer Browser Control
    • A hierarchy of Shell Namespace entities
    • Windows Shell property system
    • Drag and Drop for Shell Objects
    • Windows Vista and Windows 7 Common File Dialogs, including custom controls
    • Known Folders and non-file system containers
    • Shell Object Watcher
    • Shell Extensions API support
  • DirectX
    • Direct3D 11.0, Direct3D 10.1/10.0, DXGI 1.0/1.1, Direct2D 1.0, DirectWrite, Windows Imaging Component (WIC) APIs
  • Windows Vista and Windows 7 Task Dialogs
  • Sensor Platform APIs
  • Extended Linguistic Services APIs
  • Power Management APIs
  • Application Restart and Recovery APIs
  • Network List Manager APIs
  • Command Link control and System defined Shell icons
What’s New in this update (v1.1):
The enhancements in this update of Code Pack are:
  • Many FxCop violations and PREfast warnings have been addressed
  • Bug fixes across various features and samples
    • Includes many API improvements
  • New features
    • Shell Object Watcher
    • Preview Handler APIs
    • Thumbnail Handler APIs
  • New samples for the new features
  • Visual Studio 2010 compliance
  • Initial xUnit test coverage
  • String localization
  • Signed assemblies

Sure I've know about the Windows API Code Pack for years, but it never clicked that I could use it to get this kind of file metadata... sigh... so much to learn, so few brain cells (left). Yes, it's dated, but the source is available...

 

Related Past Post XRef:
How many ways are there to create a File Watcher? Well, here's three at least...
Windows API Code Pack v1.1 Released (Think “Bug fix, new Shell/Thumbnail/Preview features, VS2010, xUnit, string localization, signed assemblies and more” release)
More Windows Code Pack and Windows 7 developing delightfulness
Windows 7 Code Pack v1.0 Released – Managed code to help get at the yummy Windows 7 filling…
Bridging to Managed Windows 7 Development – Vista Bridge to Windows Code Pack
Vista Bridge v1.4 Released – Now with custom controls for Common File Dialogs, BreadCrumb control and Aero Glass
Vista Bridge (v1.3) available on MSDN Code Gallery
It’s the Bridge to… Vista – Getting and installing Vista Bridge Sample Library

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in .Net, Development, EDD, Windows7, Windows8, Windows8.1 | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Mr. 7,000! This is my 7,000th post...
    Before this post; After; 20 visits between taking these snaps? Oh wait, that's probably me searching for past related posts....
  • "Windows Server Essentials Media Pack" (DNLA Stream, HTML5 and Dashboard Media stuff)
    Microsoft Downloads - Windows Server Essentials Media Pack This pack enables the media streaming functionality for Windows Server 2012...
  • Rad Gate Post... Get your Red Gate Post here...
    simple talk - Melanie Townsend - Get a copy of the Red Gate Post We recently put together a newspaper of some of the best articles fr...
  • Windows Management Framework 4.0 (PowerShell 4, PowerShell ISE, Management OData, WMI, etc.) now available
    Keith Hill's Blog - PowerShell 4.0 Now Available You can get PowerShell 4.0 for down level operating systems now via the WMF 4.0 d...
  • Viasfora - Your new favorite Visual Studio Text/*ML Editing Extension?
    Winterdom - Introducing Viasfora A couple of days ago, I unveiled Viasfora , my latest attempt at building a decently packaged extensi...
  • "Windows Server [2012 R2]: The Best Infrastructure to Run Linux Workloads"
    In the Cloud - What’s New in 2012 R2: Enabling Open Source Software Part 4 of a 9-part series . ... There are a lot of great s...
  • [Hardware Review] Life with Haswell... Haswell/Harris Beach Intel SDS Ultrabook Review - Part 2
    "So Greg, how's life with Haswell been?" "Pretty Sweet! (Mostly)" I've been given an opportunity to review t...
  • Fuzzy Lookup Add-In for Excel (Insert lame "Fuzzy, wuzzy was an Excel..." snip here)
    Microsoft Downloads - Fuzzy Lookup Add-In for Excel The Fuzzy Lookup Add-In for Excel performs fuzzy matching of textual data in Exce...
  • Caliburn.Micro v1.5.0 released (CM gets Tasks, Async/Await and Share/Setting for RT... and bug fixes of course)
    Caliburn.Micro - Caliburn.Micro v1.5.0 "Release Notes This release fixes many bugs. It also adds support for Task and async/a...
  • Just about everything you ever wanted to know about SQL Server Date and Time Data Types...
    CodeProject - Date and Time Data Types and Functions - SQL Server (2000, 2005, 2008, 2008 R2, 2012) Introduction It would be bette...

Categories

  • .Net
  • 3DPrinting
  • AFeedYouShouldRead
  • Agile
  • ALM
  • Amazon
  • Amiga
  • Analytics
  • Android
  • ASP.NET
  • Azure
  • BigData
  • bing
  • Blogging
  • Book
  • BookReview
  • BUILD
  • C
  • C#
  • C++
  • Career
  • Cat
  • cheatsheet
  • ClickOnce
  • Cloud
  • ComputerHardware
  • css
  • Data
  • DBA
  • DependencyInjection
  • Deployment
  • Design
  • Development
  • devops
  • DVCS
  • ebook
  • EDD
  • Education
  • EnterpriseLibrary
  • EntityFramework
  • Exchange
  • Expression
  • gadget
  • Game
  • GIT
  • Google
  • Government
  • Hadoop
  • hardware
  • HardwareReview
  • HaswellReview
  • HTML5
  • Humor
  • IE
  • IEExtension
  • IfAllElseFails
  • IIS
  • ILMerge
  • Image
  • Infographic
  • interview
  • InversionOfControl
  • Java
  • Javascript
  • Kinect
  • LightSwitch
  • LINQ
  • Linux
  • LosAngeles
  • Lucene
  • Lync
  • MEF
  • Metro
  • MicrosoftOffice
  • MicrosoftOutlook
  • Mono
  • MVC
  • MVVM
  • NetMon
  • NLP
  • NoSQL
  • NuGet
  • OData
  • OneNote
  • OpenXML
  • Paint.Net
  • Personal
  • Photosynth
  • Physics
  • portable
  • Poster
  • PowerShell
  • Preparedness
  • Presentation
  • Prism
  • PrivateCloud
  • RegEx
  • RemoteDesktop
  • Reporting
  • RIAServices
  • Science
  • ScienceFiction
  • Scratch
  • Scrum
  • ServiceBus
  • SharePoint
  • Silverlight
  • SimiValley
  • SPA
  • Space
  • SQLServer
  • Storyboard
  • Surface
  • SVG
  • SystemAdministration
  • T4
  • TeamBuild
  • TeamFoundationServer
  • TechEd
  • Training
  • TypeScript
  • UnitTesting
  • UnityApplicationBlock
  • Utility
  • Veteran
  • VirtualMachine
  • Visio
  • VisualBasic
  • VisualStudio
  • WCF
  • Web X.X
  • Webcast
  • WebFeed
  • WebMatrix
  • Windows
  • Windows7
  • Windows8
  • Windows8.1
  • WindowsHomeServer
  • WindowsLiveWriter
  • WindowsPhone
  • WindowsServer
  • WinRT
  • WiX
  • WMI
  • WOPI
  • WPF
  • XAML
  • XBox360
  • XboxOne
  • zombie

Blog Archive

  • ▼  2013 (500)
    • ►  December (12)
    • ►  November (61)
    • ▼  October (65)
      • WindowSMART (The HD/SSD health monitoring, reporti...
      • 11 for 12... 11 Free SQL Server 2012 Microsoft Vir...
      • TechBooks, your Windows 8.1 window to discovering,...
      • "Halloween Costumes for Programmers" Comic
      • “Ship it, Maybe” - Yammer's software shipping parody
      • Mr. 7,000! This is my 7,000th post...
      • Welcome OctoGit... I mean, Octokit.Net for GitHub
      • Mastering MDS with the Master Data Services Operat...
      • Windows Azure Guidance - Cloud Design Patterns Alp...
      • "We're from the Government and we're to help with ...
      • Zombie Post of the Day #2: Zombie Combat Battalion...
      • Zombie Post of the Day #1: "Cloudy with a chance o...
      • Hotfix released to remove 'SecureBoot isn't config...
      • Clide, your guide to Visual Studio Extensibility s...
      • Toward Metadata Mastery with the Windows API Code ...
      • "Theory and Applications for Advanced Text Mining"...
      • Seven for SQL... Seven Free eBooks from Pinal Dave...
      • Surface RT Battery draining faster than you're use...
      • Internet Archive's Historical Software Archive = R...
      • Jesse's got your number (of Insanely Essential Pro...
      • Windows Management Framework 4.0 (PowerShell 4, Po...
      • Wriju's TFS 2013 Book and Video Link Round-up
      • XPlatformCloudKit - Your Cross Windows Phone, Wind...
      • Jason's Spa (err... I mean, Jason Haley's new SPA,...
      • Doughnuts! (Well, Infragistics XAML Doughnut Chart...
      • Doughnuts! (Well, Infragistics XAML Doughnut Chart...
      • Only for the cool cats (SQL Cat's are cool be defi...
      • Free eBook of the Day: "45 Database Performance Ti...
      • Page File = RAM x 1.5? Not so fast if you're x64...
      • AsmSpy [Assembly Spy] (Think "commandDepends for ...
      • "Introducing Windows 8.1 for IT Professionals: Tec...
      • patterns & practices: Data Access Guidance code dr...
      • "Windows Server Essentials Media Pack" (DNLA Strea...
      • You can only turn "SecureBoot isn't configured cor...
      • sp_AskBrent - Your new, "OMG, my SQL Server is soo...
      • Shining the light on 30 Code Samples, 9 Technologi...
      • bing up your app with the new Bing Speech Recognit...
      • Magic Method to Move from Windows 8.1 Preview to W...
      • Visual Studio 2013, Team Foundation Server 2013, ....
      • Windows 8.1 Now Available...(For Everyone)
      • [Hardware Review] It's been a Haswell Summer... Ha...
      • Revisiting Sando - Full Text Index and Source your...
      • IntelliCommand, the key to learning Visual Studio ...
      • PIE! (charts) - Log Parser and the Office Web Comp...
      • Besides tearing your hair out, how you debug why y...
      • Some TweetSharp, Accord.Net and the author's code ...
      • Habitat for Humanity SF/SCV, USO Greater Los Angel...
      • //? = Taking "Google Coding" to the next level? Fl...
      • This is a railroading you'll actually look forward...
      • How do the Microsoft Office Servers Integrate? Her...
      • Making SQL Server a happy kCura Relativity camper ...
      • Grant's TFS Grooming Guide (Think "How to keep you...
      • OpenGov.com, where your Local Government can get n...
      • Comparing Sentiment Analysis REST API's
      • XAML Spy v2 Beta Visual Studio now available... (t...
      • DebugDiag v2 is now out...
      • The Surface surface... Three Surface sites you sho...
      • VMware or Microsoft? 35 posts, six weeks, two prod...
      • No need to say no to NoSql - "Data Access for High...
      • Can you Kinect me now... Using the Kinect for Wind...
      • A Decade+ of Start Pages - Visual Studio Start Pag...
      • [Insert really lame Mime joke here] MimeKit v0.5 (...
      • Lets Get Physical [JavaScript] - PhysicsJS
      • WAMVA - Windows Azure Microsoft Virtual Academy co...
      • This is IT for Azure... "Introducing Windows Azure...
    • ►  September (38)
    • ►  August (47)
    • ►  July (75)
    • ►  June (39)
    • ►  May (40)
    • ►  April (42)
    • ►  March (39)
    • ►  February (42)
Powered by Blogger.

About Me

Unknown
View my complete profile