form1.frm

来自「本文件包含200个visual baisc实例」· FRM 代码 · 共 70 行

FRM
70
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "隐藏、显示windows任务栏"
   ClientHeight    =   1350
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3780
   LinkTopic       =   "Form1"
   ScaleHeight     =   1350
   ScaleWidth      =   3780
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command3 
      BackColor       =   &H00FFC0C0&
      Caption         =   "退出"
      Height          =   450
      Left            =   2490
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   480
      Width           =   1200
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "显示任务栏"
      Height          =   450
      Left            =   1290
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   480
      Width           =   1200
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "隐藏任务栏"
      Height          =   450
      Left            =   75
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   480
      Width           =   1200
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'函数声明
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_SHOWWINDOW As Long = &H40
Private Const SWP_HIDEWINDOW As Long = &H80
Private Const SWP_NOACTIVATE As Long = &H10

Private Sub Command1_Click()
  Dim hide As Long
      hide = FindWindow("Shell_traywnd", vbNullString)
  Call SetWindowPos(hide, 0, 0, 0, 0, 0, SWP_HIDEWINDOW)
End Sub

Private Sub Command2_Click()
  Dim show As Long
      show = FindWindow("Shell_traywnd", vbNullString)
  Call SetWindowPos(show, 0, 0, 0, 0, 0, SWP_SHOWWINDOW)
End Sub

Private Sub Command3_Click()
  End
End Sub

⌨️ 快捷键说明

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