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

📄 form1.frm

📁 vb 窗体实例 都是自己的例子
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form1 
   BackColor       =   &H00FFC0C0&
   Caption         =   "在任务栏中禁用右键快捷菜单"
   ClientHeight    =   1620
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3795
   LinkTopic       =   "Form1"
   ScaleHeight     =   1620
   ScaleWidth      =   3795
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command3 
      BackColor       =   &H00FF8080&
      Caption         =   "退出"
      Height          =   435
      Left            =   255
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   705
      Width           =   3300
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FF8080&
      Caption         =   "允许使用任务栏中右键快捷菜单"
      Height          =   435
      Left            =   1950
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   180
      Width           =   1590
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FF8080&
      Caption         =   "禁止使用任务栏中右键快捷菜单"
      Height          =   435
      Left            =   255
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   180
      Width           =   1590
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   15
      TabIndex        =   3
      Top             =   1215
      Width           =   3750
   End
End
Attribute VB_Name = "form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
 Option Explicit
 Const REG_DWORD As Long = 4
 Const HKEY_CURRENT_USER = &H80000001
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long

Private Declare Function RegDeleteValue& Lib "advapi32.dll" Alias "RegDeleteValueA" _
    (ByVal hKey As Long, ByVal lpValueName As String)

Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" _
   (ByVal hKey As Long, ByVal lpSubKey As String, phkResult 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
  RegCreateKey HKEY_CURRENT_USER, _
  "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", hKey
  Dim L As Long
  L = 1
  RegSetValueEx hKey, "notraycontextmenu", 0, REG_DWORD, L, 4
  MsgBox "已禁止使用任务栏中的右键快捷菜单! 请重新启动计算机,试用任务栏中的右键快捷菜单。"
  RegCloseKey hKey
End Sub

Private Sub Command2_Click()
  Dim hKey As Long
  RegCreateKey HKEY_CURRENT_USER, _
  "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", hKey
  RegDeleteValue hKey, "notraycontextmenu"
  MsgBox "已允许用任务栏中的右键快捷菜单! 请重新启动计算机,试用任务栏中的右键快捷菜单。"
  RegCloseKey hKey
End Sub

Private Sub Command3_Click()
  End
End Sub

⌨️ 快捷键说明

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