Exemple #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);
                }
            }
        }
Exemple #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;
                }
            }
        }