Browse by Tags

Tagged Content List
  • Blog Post: Creating a WPD playlist object in C#

    This is a C# follow-up post on the earlier C++ playlist creation post . Be sure to read the earlier post for background information on playlists and how it stores references. We will also re-use the StringToPropVariant helper function that we defined in our previous post . To create a playlist object...
  • Blog Post: Creating WPD PROPVARIANTs in C# without using interop

    Previous posts have covered how to create, manage and marshal PROPVARIANTs using interop. Here's a way on how to create a PROPVARIANT without interop. The IPortableDeviceValues interface exposes a SetStringValue method that allows a regular C# string to be added into the collection. IPortableDeviceValues...
  • Blog Post: Marshalling variant properties in C#

    This post is a continuation of the one covering WPD property retrieval in C# . That post explained how to marshal strings and the basic int properties. Handling other types such as VT_DATE and VT_BOOL is trickier so I'll try to cover them here. VT_DATE VT_DATE variants hold the date time value in a field...
  • Blog Post: WPD Content Enumeration in C#

    WPD content enumeration in C# is pretty close to the C++ style. Here's a basic example that enumerates the object IDs of the objects present on the device. static void Enumerate( ref PortableDeviceApiLib.IPortableDeviceContent pContent, string parentID, string indent) { // // Output object...
  • Blog Post: Setting WPD properties in C#

    Since setting a WPD property requires manipulating a PROPVARIANT structure through interop, we must make use of the marshalling rules we set in our last post . We'll take a look at a function that allows string properties to be set. static void SetStringValue( PortableDeviceApiLib.PortableDeviceClass...
  • Blog Post: WPD property retrieval in C#

    WPD property values are retrieved as PROPVARIANTs through the WPD API. Unfortunately there is no native support for PROPVARIANTs in C#. To correctly retrieve the property values (or anything that is in a PROPVARIANT) through the WPD API in C#, we must use marshalling. PortableDeviceApiLib.tag_inner_PROPVARIANT...
  • Blog Post: Where are the WPD property keys in C#?

    If you followed the exercise from our first C# post , you must have noticed that the PortableDeviceApi and PortableDeviceTypes typelibs don't expose the WPD property keys such as WPD_OBJECT_ID, WPD_OBJECT_FORMAT, etc. This can be a major blocker since for starters, we need to specify a basic set of client...
  • Blog Post: C# and the WPD API

    There currently is no managed/C# flavor of the WPD API. This, of course, doesn't mean that you are locked out from using the WPD API if you want to use C#. Since the API is a set of COM interfaces, we simply have to interop across from C#. Granted it isn't as easy as a native C# implementation, but it...
Page 1 of 1 (8 items)