Posts filed under 'Tools'
How to attach the debugger at application startup
You may have already found the solution to this in the SDK, if not; search the SDK help for “Debugging” and check the first hit.
I have created a little piece of code that makes modifying the registry key a lot easier:
(A batch file could also have done the job, but remember, I’m a software developer)
Create a WinForm app, include the class below and link its Enabled-property to the Checked-property of a Checkbox.
using System;
using Microsoft.Win32;
namespace MediaCenterDebugRegSetter
{
public static class MediaCenterAddInLaunchDebugging
{
public static bool Enabled
{
get
{
RegistryKey key = GetRegistryKey(false);
if (key != null)
{
object value = key.GetValue(“EnableAddInLaunchDebugging”);
key.Close();
return ((value != null) && ((int)value == 1));
}
return false;
}
set
{
RegistryKey key = GetRegistryKey(true);
if (key != null)
{
key.SetValue(“EnableAddInLaunchDebugging”, (value == true) ? 1 : 0, RegistryValueKind.DWord);
key.Flush();
key.Close();
}
}
}
private static RegistryKey GetRegistryKey(bool writable)
{
try
{
return Registry.CurrentUser.OpenSubKey(@”SoftwareMicrosoftWindowsCurrentVersionMedia CenterSettingsExtensibility”, writable);
}
catch
{
return null;
}
}
}
}
PS: Media Center must be restarted for the new setting to take effect.
3 comments March 4, 2008