⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 一款漂亮的控件。 快
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "设置"
      Height          =   375
      Left            =   1680
      TabIndex        =   0
      Top             =   1680
      Width           =   1335
   End
   Begin VB.Label Label1 
      Caption         =   $"Form1.frx":0000
      Height          =   855
      Left            =   840
      TabIndex        =   1
      Top             =   360
      Width           =   2775
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'---------------处理注册表的函数-----------------------
Const HKEY_CURRENT_USER = &H80000001
Const REG_SZ = 1
Private Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Private Declare Function RegCreateKey& Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey&, ByVal lpszSubKey$, lphKey&)

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Sub Command1_Click()
 Dim hKey As Long, SubKey As String, Exe As String

    SubKey = "Software\Microsoft\Windows\CurrentVersion\Run"
    Exe = "notepad"
    RegCreateKey HKEY_CURRENT_USER, SubKey, hKey
    
    RegSetValueEx hKey, "记事本", 0, REG_SZ, ByVal Exe, _
                  LenB(StrConv(Exe, vbFromUnicode)) + 1
    RegCloseKey hKey
    
    MsgBox "notepad 程序已经被设定成 Windows 启动时自动被执行的程序!"

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -