private void PopulatePropertyInfo() { if (m_properties.Count == 0) { // Need to actually fetch properties // Start with getting a list of all the properties UInt32 count = 0; // Get # of properties UInt32 hr = GetPropertyList(m_handle, IntPtr.Zero, ref count); int[] ids = new int[count]; IntPtr pIds = Marshal.AllocCoTaskMem((int)count * sizeof(UInt32)); hr = GetPropertyList(m_handle, pIds, ref count); Marshal.Copy(pIds, ids, 0, (int)count); Marshal.FreeCoTaskMem(pIds); // Now I want the property descriptors for (int i = 0; i < count; i++) { PropertyDescriptor descriptor = new PropertyDescriptor(); hr = GetPropertyDescriptor(m_handle, (uint)ids[i], ref descriptor); PropertyValueOption[] options = new PropertyValueOption[descriptor.ValueCount]; for (uint index = 0; index < descriptor.ValueCount; index++) { GetPropertyValueOption(m_handle, descriptor.Id, ref options[index], index); // UInt32 countReturned = descriptor.ValueCount; // GetPropertyValueOptions(m_handle, descriptor.Id, ref options, ref countReturned); } m_properties[descriptor.Id] = new CameraProperty(descriptor, options); } } }
protected static extern UInt32 GetPropertyValueOption(UInt32 hCamera, UInt32 propertyId, ref PropertyValueOption option, UInt32 index);