VB,帮我在每行的后面翻译这个小程序,我交作业。

来源:百度知道 编辑:UC知道 时间:2024/05/18 01:35:45
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

Option Explicit
Const SPI_GETWORKAREA = 48 '设置常量SPI_GETWORKAREA

Private Type RECT '自定义类型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() ;按键1
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
'在Label1显示apiRECT 的宽和高
Else
Print "调用 SystemPara