ㆍ언어대상 : C# ㆍ실행대상 : CAD ㆍ작성자 : 김민석
//AutoSetting for NET Load Registry
using Microsoft.Win32;
using System.Reflection;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
[CommandMethod("RegisterMyApp")]public void RegisterMyApp()
{// Get the AutoCAD Applications key
string sProdKey = HostApplicationServices.Current.RegistryProductRootKey;
string sAppName = "MyApp";
RegistryKey regAcadProdKey = Registry.CurrentUser.OpenSubKey(sProdKey);
RegistryKey regAcadAppKey = regAcadProdKey.OpenSubKey("Applications", true);// Check to see if the "MyApp" key exists
string[] subKeys = regAcadAppKey.GetSubKeyNames();
foreach (string subKey in subKeys)
{// If the application is already registered, exit
if (subKey.Equals(sAppName))
{regAcadAppKey.Close();
return;
}
}
// Get the location of this module
string sAssemblyPath = Assembly.GetExecutingAssembly().Location;
// Register the application
RegistryKey regAppAddInKey = regAcadAppKey.CreateSubKey(sAppName);
regAppAddInKey.SetValue("DESCRIPTION", sAppName, RegistryValueKind.String); regAppAddInKey.SetValue("LOADCTRLS", 14, RegistryValueKind.DWord); regAppAddInKey.SetValue("LOADER", sAssemblyPath, RegistryValueKind.String); regAppAddInKey.SetValue("MANAGED", 1, RegistryValueKind.DWord);regAcadAppKey.Close();
}
[CommandMethod("UnregisterMyApp")]public void UnregisterMyApp()
{// Get the AutoCAD Applications key
string sProdKey = HostApplicationServices.Current.RegistryProductRootKey;
string sAppName = "MyApp";
RegistryKey regAcadProdKey = Registry.CurrentUser.OpenSubKey(sProdKey);
RegistryKey regAcadAppKey = regAcadProdKey.OpenSubKey("Applications", true);// Delete the key for the application
regAcadAppKey.DeleteSubKeyTree(sAppName);
regAcadAppKey.Close();
}
해당 내용은 (주)데브존의 웹봇이 자동으로 저희 홈페이지와 API로 동기화한 내용입니다. 자세한 내용은 홈페이지 http://www.devzone.co.kr 또는 모바일 폰에서 http://devzone.co.kr을 접속 하여 확인해 보시기 비랍니다.
- 대표 전화 : 02) 2061 - 0753 - Fax : 02) 2061 - 0759 - Skype : devzone24
- 주소 : 서울특별시 양천구 목1동 923-14. 현대드림타워 1024호
- 기술 문의: 02) 2061-1259 김민석 기술이사
- 대표 전화 : 02) 2061 - 0753 - Fax : 02) 2061 - 0759 - Skype : devzone24
- 주소 : 서울특별시 양천구 목1동 923-14. 현대드림타워 1024호
- 기술 문의: 02) 2061-1259 김민석 기술이사
댓글 없음:
댓글 쓰기