Click here to Skip to main content
13,087,235 members (58,209 online)
Click here to Skip to main content


48 bookmarked
Posted 21 Jun 2006

Accessing WMF metadata with C#

, 21 Jun 2006
An article on how to use C# and the Windows Media Format SDK to read metadata in Windows Media Format files.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WMFMetadataReader
    public partial class FormMain : Form
        public FormMain()

        private void btnBrowse_Click(object sender, EventArgs e)
            openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter = "wmv files (*.wmv)|*.wmv";
            openFileDialog1.FilterIndex = 1;
            openFileDialog1.RestoreDirectory = true;   //whether or not to remember last directory

            DialogResult Result = openFileDialog1.ShowDialog();

            ///if we get a file, put path and name in textbox
            if (Result == DialogResult.OK)
                txtFileName.Text = openFileDialog1.FileName;


            // Cancel button was pressed.
            else if (Result == DialogResult.Cancel)

        private void cbFieldChooser_SelectedIndexChanged(object sender, EventArgs e)
            //make sure filename has a value
            if (txtFileName.Text == "")
                lblError.Visible = true;
                MetaDataReader objMetaData = new MetaDataReader();
                txtValue.Text = objMetaData.GetFieldByName(txtFileName.Text, cbFieldChooser.SelectedItem.ToString());
            }//end else we have a file to process


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Kris Rudin
Web Developer
United States United States
Kris Rudin is a senior developer with Ascentium corporation, with 10 years of experience including both web and Windows client software development.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.170813.1 | Last Updated 21 Jun 2006
Article Copyright 2006 by Kris Rudin
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid