Game Development Reference
In-Depth Information
HandleCommand(_commands[info.Verb - 1].ToString(), _fileNames);
}
catch (Exception exception)
{
HandleError(exception);
}
}
Registration of the extension component is covered later in the chapter, but it is
important that the following two methods are discussed.
The RegisterExtension() method is used to place an entry in the approved shell
extensions (for WINNT), and to associate the extension component with the file
extensions array.
protected static void RegisterExtension(System.Type type,
string[] extensions,
string handlerName)
{
try
{
string guid = InterogateGuid(type);
if (guid.Length > 0)
{
RegistryKey key;
key = Registry.LocalMachine.OpenSubKey(“Software\\” +
“Microsoft\\” +
“Windows\\” +
“CurrentVersion\\” +
“Shell Extensions\\” +
“Approved”, true);
key.SetValue(guid,
String.Format(“{0} shell extension”, handlerName));
key.Close();
foreach (string extension in extensions)
{
string path = String.Format(“{0}\\shellex\\ContextMenuHandlers\\{1}”,
extension,
handlerName)
key = Registry.ClassesRoot.CreateSubKey(path);
key.SetValue(string.Empty, guid);
Search Nedrilad ::




Custom Search