乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 95|回复: 4

怎样把文件添加到启动组?

[复制链接]

75

主题

306

帖子

10

银币

中流砥柱

Rank: 25

铜币
606
发表于 2015-7-24 08:34:00 | 显示全部楼层 |阅读模式
怎样通过编程的方式将文件添加到启动组?

jxhjrcry0v3.jpg

jxhjrcry0v3.jpg

回复

使用道具 举报

72

主题

2726

帖子

9

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3014
发表于 2015-7-24 19:07:00 | 显示全部楼层
写入注册表 kean有相关的例子
回复

使用道具 举报

75

主题

306

帖子

10

银币

中流砥柱

Rank: 25

铜币
606
发表于 2015-7-25 22:16:00 | 显示全部楼层
请老师给个链接!
回复

使用道具 举报

72

主题

2726

帖子

9

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3014
发表于 2015-7-27 22:37:00 | 显示全部楼层
置顶的kean专题
回复

使用道具 举报

9

主题

29

帖子

1

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
65
发表于 2015-8-10 11:08:00 | 显示全部楼层
'''
    ''' 让程序随CAD自动启动
    '''
    '''
    Public Sub RegisterMyApp()
        '获得 AutoCAD 应用程序注册表键
        Dim sProdKey As String = HostApplicationServices.Current.RegistryProductRootKey
        'Dim sAppName As String = "MyApp"
        Dim sAppName As String = My.Application.Info.AssemblyName
        Dim regAcadProdKey As RegistryKey = Registry.CurrentUser.OpenSubKey(sProdKey)
        Dim regAcadAppKey As RegistryKey = regAcadProdKey.OpenSubKey("Applications", True)
        '检查“MyApp”键是否存在
        Dim subKeys() As String = regAcadAppKey.GetSubKeyNames()
        For Each sSubKey As String In subKeys
            '' 如果已经存在就退出  If the application is already registered, exit
            If (sSubKey.Equals(sAppName)) Then
                '删除已经添加
                UnregisterMyApp()
                'MsgBox("已经添加了!", MsgBoxStyle.Exclamation, "提示")
                'regAcadAppKey.Close()
                'Exit Sub
            End If
        Next
        '' 获得模块的位置   Get the location of this module
        Dim sAssemblyPath As String = Assembly.GetExecutingAssembly().Location
        '' 注册应用程序  Register the application
        Dim regAppAddInKey As RegistryKey = 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()
    End Sub
    '''
    ''' 删除程序自启动
    '''
    '''
    Public Sub UnregisterMyApp()
        '' 获得 AutoCAD 应用程序注册表键Get the AutoCAD Applications key
        Dim sProdKey As String = HostApplicationServices.Current.RegistryProductRootKey
        'Dim sAppName As String = "MyApp"
        Dim sAppName As String = My.Application.Info.AssemblyName
        Dim regAcadProdKey As RegistryKey = Registry.CurrentUser.OpenSubKey(sProdKey)
        Dim regAcadAppKey As RegistryKey = regAcadProdKey.OpenSubKey("Applications", True)
        '' 删除应用程序键  Delete the key for the application
        Try
            regAcadAppKey.DeleteSubKeyTree(sAppName)
        Catch ex As Exception
            MsgBox("已经取消了!", MsgBoxStyle.Exclamation, "提示")
        End Try
        regAcadAppKey.Close()
    End Sub
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 10:26 , Processed in 0.547910 second(s), 76 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表