Introduction
I have been running Windows 8 Developer Preview for a while now. Since my laptop does not support touch, I am stuck with the new Metro style Start menu. Honestly, it rocks on touch! but I prefer the classic Start menu of Windows 7.
I surfed the web for a while looking up a way to disable the new metro Start menu and use the classic Windows 7 instead. Many websites pointed out that it is controlled through the Windows Registry under HKEY_CURRENT_USER\Software\Microsoft\Windows\ CurrentVersion\Explorer using the Value of RPEnabled. Metro’s value is 1 and classic Windows 7 is 0.
I decided to ease the toggle by writing an application (called it “Metro Style Toggle”) that updates the RPEnabled registry value. In this post, I will share how I managed to read/write Windows Registry values to switch between the shell styles.
Background
To quickly summarize the code:
- Read the
RPEnabled
Registry value using Microsoft.Win32.Registry.GetValue
and reflect the state on the UI by updating the status label and disabling the current status toggle button. So for example, if the current status is Metro, then the Metro toggle should be disabled. - When the user toggles the state, I use
Microsoft.Win32.Registry.SetValue
to update the RPEnabled
Registry value. So for example, If the user wants to switch back to Metro, then RPEnabled
should be updated to become 1
. - An alert is displayed to the user asking them to restart their machine for changes to take effect.
I wrote the code to run on the Windows 8 Developer Preview, I have no clue if it will run on the Beta or RTM releases. Furthermore, you have to run this application as an Administrator, otherwise it will fail to update the Windows Registry (It worked with me without Administrative privileges, maybe because I am the administrator
, still better to run it as Administrator). Please note that Windows might ask you to install Microsoft .NET Framework 3.5 with SP1 using the Windows Features Activation if you have not activated the runtime yet.
Metro Style

Classic Windows 7 Style

Source Code
The easiest way for me to explain the source code was to comment on it and paste it here. So for you geeks who are interested in the source code, let’s start digging:
using System;
using Microsoft.Win32;
using System.Windows.Forms;
using System.Diagnostics;
namespace MetroStyleToggle
{
public partial class ToggleControl : Form
{
public ToggleControl()
{
InitializeComponent();
}
enum ShellStatus { Metro, Classic, Unknown }
ShellStatus currentShellStatus;
string registryPath = @"HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Explorer",
registryValue = "RPEnabled";
string metroStyle = "1", classicStyle = "0", currentKeyValue = "",
restartMessege = "Restart needed for updates to take effect.";
private void ToggleControl_Load(object sender, EventArgs e)
{
SetShellStatusMessege();
}
private void SetShellStatusMessege()
{
currentKeyValue = GetRegistryValue(registryPath, registryValue);
SetShellStatus(currentKeyValue);
ShellStatusMessege.Text = currentShellStatus.ToString();
}
private void SetShellStatus(string status)
{
if (status == metroStyle)
{
currentShellStatus = ShellStatus.Metro;
MetroToggle.Enabled = false;
ClassicToggle.Enabled = true;
}
else if (status == classicStyle)
{
currentShellStatus = ShellStatus.Classic;
MetroToggle.Enabled = true;
ClassicToggle.Enabled = false;
}
else
{
currentShellStatus = ShellStatus.Unknown;
}
}
public string GetRegistryValue(string path, string value)
{
return Convert.ToString(Registry.GetValue(path, value, "Unknown"));
}
public void SetRegistryValue(string path, string value, string shell)
{
Registry.SetValue(path, value, shell);
}
private void MetroToggle_Click(object sender, EventArgs e)
{
try
{
SetRegistryValue(registryPath, registryValue, metroStyle);
SetShellStatusMessege();
MessageBox.Show(restartMessege,this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
catch (Exception ex)
{
ShellStatusMessege.Text = "Error: " + ex.Message;
}
}
private void ClassicToggle_Click(object sender, EventArgs e)
{
try
{
SetRegistryValue(registryPath, registryValue, classicStyle);
SetShellStatusMessege();
MessageBox.Show(restartMessege, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
catch (Exception ex)
{
ShellStatusMessege.Text = "Error: " + ex.Message;
}
}
private void BlogLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(BlogLink.Text);
}
}
}
Well, that’s it. 
I am a huge fan of the Barcelona football team and the Spanish football league. I love socializing with my IT peers and solving programming challenges. I was part of my university ACM ICPC team twice. In addition I’m addicted to workshops, presentations, and proof of concepts. Working hard on that, Microsoft awarded me the MVP award 4 years.
I remember the first time I wanted to be an MVP was during the Microsoft campaign for Longhorn. Watching these guys on stage presenting the future was a thrilling experience for me. I just wanted to be that guy who climbs the stage; tell people about new features; fires up a virtual machine and demo great stuff; answer their questions, and throw giveaways at them! Being an MVP gave me the adrenalin rush and satisfaction I was looking for. Later I presented in many Microsoft regional events, such as East Med Developers Conference, Momentum, Partner Readiness, Visual Studio Tour, and Academic Day with a total of more than 400 sessions.
Technically, I’m in love with my wife
, SharePoint, and BizTalk! I specialize also in Enterprise Project Management (Project Server and Portfolio Server); Visual Studio Team System; Customer Care Framework (CCF), and Hyper-V. In addition to my technical knowledge, I have excellent experience with Governance, Risk Management, and Compliance (GRC) and IT Service Management (ITSM). I’m ITIL v3 certified and I have wide experience working with MOF and COBIT.