Definition of a function, with the current boot loader assembly AutoCAD to AutoCAD, involving written to the registry, it is noted that the processing method after dll loaded within AutoCAD. . . .
Write HKLM means that all user login will be affected (autocad needs to be started in order to successfully written to the registry as an administrator) , write that the user currently logged in HKCU will affect income
"LOADCTRLS": control program loaded with CAD, CAD set to Ox02 with the boot loader together;
"LOADER": Tell path to load the CAD program;
"the MANAGED": Set Ox01, which is hosting tell CAD program.
Note that 32 is a cad on the computer 64 if the write registry HKLM by different paths "HKEY_LOCAL_MACHINE \ SOFTWARE \ WOW6432Node \"
Note that 32 is a cad on the computer 64 if the write HKCU registry by different paths "HKEY_LOCAL_MACHINE \ SOFTWARE \"
. 1 '' ' <Summary> 2 ' '' will start assembly registry write registry with acad . 3 '' ' </ Summary> . 4 ' '' <param name = "keyLocal"> the HKLM, the HKCU </ param> . 5 Private the Shared Sub DllAutoLoader (keyLocal of As the RegistryKey) . 6 . 7 Dim regPath of As String = HostApplicationServices.Current.RegistryProductRootKey ' Software \ the Autodesk \ the AutoCAD \ R18.0 \ ACAD-8001: 804 . 8 Dim ED of As Editor = Application.DocumentManager.MdiActiveDocument. Editor , 9 the Dim assName = Assembly.GetExecutingAssembly().CodeBase 10 Dim apps_Acad = keyLocal.OpenSubKey(Path.Combine(regPath, "Applications"), False) 11 Dim counts = apps_Acad.SubKeyCount, flag As Boolean = False 12 For Each item As String In apps_Acad.GetSubKeyNames() 13 If item = Path.GetFileNameWithoutExtension(assName) Then flag = True 14 Next 15 If flag = False Then 16 Dim autocad_App As Microsoft.Win32.RegistryKey 17 autocad_App = keyLocal.OpenSubKey(Path.Combine(regPath, "Applications"), True) 'RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl 18 Dim myNerLoader = autocad_App.CreateSubKey(Path.GetFileNameWithoutExtension(assName), RegistryKeyPermissionCheck.Default) 19 myNerLoader.SetValue("DESCRIPTION", "加载自定义dll文件", Microsoft.Win32.RegistryValueKind.String) 20 myNerLoader.SetValue ( " LOADCTRLS " , 2 , Microsoft.Win32.RegistryValueKind.DWord) 21 is myNerLoader.SetValue ( " LOADER " , assName, Microsoft.Win32.RegistryValueKind.String) 22 is myNerLoader.SetValue ( " the MANAGED " , . 1 , the Microsoft. Win32.RegistryValueKind.DWord) 23 Application.ShowAlertDialog (Path.GetFileNameWithoutExtension (assName) + " program automatically loading is complete, restart AutoCAD into force! " + Environment.NewLine + " registry address is: " +myNerLoader.Name) 24- Else 25 Application.ShowAlertDialog (Path.GetFileNameWithoutExtension (assName) + " automatically loaded, no need to repeat the load! " ) 26 End the If 27 End Sub