private void StringToPropVariant(string objectId, out PortableDeviceApiLib.tag_inner_PROPVARIANT pv) { IPortableDeviceValues values = (PortableDeviceApiLib.IPortableDeviceValues) new PortableDeviceTypesLib.PortableDeviceValues(); values.SetStringValue(ref pKey.WPD_OBJECT_ID, objectId); values.GetValue(ref pKey.WPD_OBJECT_ID, out pv); }
private void uLongIntToPropVariant(ulong value, out PortableDeviceApiLib.tag_inner_PROPVARIANT propvarValue) { // We'll use an IPortableDeviceValues object to transform the // string into a PROPVARIANT PortableDeviceApiLib.IPortableDeviceValues pValues = (PortableDeviceApiLib.IPortableDeviceValues) new PortableDeviceTypesLib.PortableDeviceValuesClass(); // We insert the string value into the IPortableDeviceValues object // using the SetStringValue method pValues.SetUnsignedLargeIntegerValue(ref PortableDevicePKeys.WPD_OBJECT_ID, (ulong)value); // We then extract the string into a PROPVARIANT by using the // GetValue method pValues.GetValue(ref PortableDevicePKeys.WPD_OBJECT_ID, out propvarValue); }