Ejemplo n.º 1
0
        public void SetPropertyValue(PropertyStoreProperty property, string value)
        {
            if (_propertyStore != null)
            {
                using (var propertyValue = new NativeMethods.PROPVARIANT())
                {
                    propertyValue.SetValue(value);

                    _propertyStore.SetValue(NativeMethods.GetPkey(property), propertyValue);
                }
            }
        }
Ejemplo n.º 2
0
        public void SetValue(PROPERTYKEY key, object value)
        {
            var pv = IntPtr.Zero;

            try {
                pv = NativeMethods.PropVariantFromObject(value);
                m_IPropertyStore.SetValue(key, pv);
            }
            finally {
                if (pv != IntPtr.Zero)
                {
                    NativeMethods.PropVariantClear(pv);
                    Marshal.FreeCoTaskMem(pv);
                    pv = IntPtr.Zero;
                }
            }
        }