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

📄 form1.frm

📁 vb 窗体实例 都是自己的例子
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "判断桌面的大小"
   ClientHeight    =   2340
   ClientLeft      =   2370
   ClientTop       =   1815
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2340
   ScaleWidth      =   4680
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   390
      Left            =   1350
      TabIndex        =   1
      Top             =   1800
      Width           =   1860
   End
   Begin VB.CommandButton Command1 
      Caption         =   "判断桌面大小"
      Height          =   390
      Left            =   1350
      TabIndex        =   0
      Top             =   1230
      Width           =   1860
   End
   Begin VB.Label Label1 
      Height          =   315
      Left            =   765
      TabIndex        =   2
      Top             =   330
      Width           =   3255
   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 SPI_GETWORKAREA = 48

Private Type RECT
  Left As Long
  Top As Long
  Right As Long
  Bottom As Long
End Type

Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" _
    (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, _
    ByVal fuWinIni As Long) As Long

Private Sub Command1_Click()
  Dim lRet As Long
  Dim apiRECT As RECT
  
  lRet = SystemParametersInfo(SPI_GETWORKAREA, vbNull, apiRECT, 0)
  If lRet Then
     Label1.Caption = "宽: " & apiRECT.Right - apiRECT.Left & "  高: " & apiRECT.Bottom - apiRECT.Top
    Else
     Print "调用 SystemParametersInfo 失败"
  End If
End Sub

Private Sub Command2_Click()
  End
End Sub

⌨️ 快捷键说明

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