using System;
using Microsoft.Win32;

namespace PublicBill.RegeditAction
{
    
class RegeditAction
    
{
        [STAThread]
        
static void Main(string[] args)
        
{
            
string mediaPlayerVersion = new RegeditAction().GetRegeditData();

            Console.WriteLine(
"Windows Media Player Version: " + mediaPlayerVersion);
        }


        
/// <summary>
        
/// Get local machine the highest version of media player.
        
/// </summary>
        
/// <returns></returns>

        private string GetRegeditData()
        
{
            RegistryKey localMachine 
= Registry.LocalMachine;
            RegistryKey software 
= localMachine.OpenSubKey("SOFTWARE");
            RegistryKey microsoft 
= software.OpenSubKey("Microsoft");
            RegistryKey mediaPlayer 
= microsoft.OpenSubKey("MediaPlayer");
            RegistryKey playerUpgrade 
= mediaPlayer.OpenSubKey("PlayerUpgrade");

            
string registData = playerUpgrade.GetValue("PlayerVersion""have no this value.").ToString();

            
return registData;
        }


    }

}

posted on 2005-11-05 18:10  10cn.net  阅读(271)  评论(0编辑  收藏  举报