| Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате |
| Форум программистов > Общие вопросы по .NET и C# > регистрация dll и COM Interop |
| Автор: Perun 3.12.2009, 15:48 | ||
| Создал расширение оболочки для своего контекстного меню. Получил dll. В своём приложении использую так:
записи в реестре создаются в самой dll [code=csharp] [System.Runtime.InteropServices.ComRegisterFunctionAttribute()] static void DLLRegisterServer(String str1) { try { // For Winnt set me as an approved shellex RegistryKey root; RegistryKey rk; root = Registry.LocalMachine; rk = root.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", true);//rk.SetValue(guid.ToString(), "BatchResults shell extension"); rk.SetValue(guid, "FrontLine"); rk.Close(); // Set "Folder\\shellex\\ContextMenuHandlers\\BatchResults" regkey to my guid root = Registry.ClassesRoot; rk = root.CreateSubKey("*\\shellex\\ContextMenuHandlers\\FrontLine");// новое rk = root.OpenSubKey("*\\shellex\\ContextMenuHandlers\\FrontLine", true);// новое rk.SetValue("", guid); rk.Close(); } catch(Exception e) { System.Console.WriteLine(e.ToString()); } } [System.Runtime.InteropServices.ComUnregisterFunctionAttribute()] static void DllUnregisterServer(String str1) { try { RegistryKey root; RegistryKey rk; // Remove ShellExtenstions registration root = Registry.LocalMachine; rk = root.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", true); rk.DeleteValue(guid);//rk.DeleteValue(str1); rk.Close(); // Delete regkey root = Registry.ClassesRoot; root.DeleteSubKey("*\\ShellEx\\ContextMenuHandlers\\FrontLine"); } catch(Exception e) { System.Console.WriteLine(e.ToString()); } } [code=csharp] |
| Автор: Perun 3.12.2009, 17:49 |
| я пробовал регистрацию из командной строки через regasm(для 2.0 делаю и Regasm соответственный). Написал, что всё прошло - меню нет, а реестр заполнился. Укажите на ошибку пожалуйста |
| Автор: Perun 4.12.2009, 15:10 |
| Кто-нибудь ответит? |
| Автор: explorer 6.12.2009, 10:47 |
| А в GAC сборку свою установил? gacutils -i assembly_name.dll |
| Автор: Perun 18.12.2009, 14:33 |
| благодарю, установил! хоть и из другой темы, но решение пришло!!))) как спасибо сказать? |
| Автор: tol05 18.12.2009, 14:38 | ||
выбрать одно из двух ))) |