不要判断
只要用
SysInfo控件获取工作区大小或用GetSystemParamerterInfo函数即可, Private Sub Command1_Click() With SysInfo1
Print "WorkAreaLeft: " & .WorkAreaLeft / Screen.TwipsPerPixelX
Print "WorkAreaTop: " & .WorkAreaTop / Screen.TwipsPerPixelY
Print "WorkAreaWidth: " & .WorkAreaWidth / Screen.TwipsPerPixelX
Print "WorkAreaHeight: " & .WorkAreaHeight / Screen.TwipsPerPixelY
End With End Sub
或
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type Public Const SPI_GETWORKAREA = 48 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
Print "WorkAreaLeft: " & apiRECT.Left
Print "WorkAreaTop: " & apiRECT.Top
Print "WorkAreaWidth: " & apiRECT.Right - apiRECT.Left
Print "WorkAreaHeight: " & apiRECT.Bottom - apiRECT.Top
Else
Print "Call to SystemParametersInfo failed."
End If End Sub
只要用
SysInfo控件获取工作区大小或用GetSystemParamerterInfo函数即可, Private Sub Command1_Click() With SysInfo1
Print "WorkAreaLeft: " & .WorkAreaLeft / Screen.TwipsPerPixelX
Print "WorkAreaTop: " & .WorkAreaTop / Screen.TwipsPerPixelY
Print "WorkAreaWidth: " & .WorkAreaWidth / Screen.TwipsPerPixelX
Print "WorkAreaHeight: " & .WorkAreaHeight / Screen.TwipsPerPixelY
End With End Sub
或
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type Public Const SPI_GETWORKAREA = 48 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
Print "WorkAreaLeft: " & apiRECT.Left
Print "WorkAreaTop: " & apiRECT.Top
Print "WorkAreaWidth: " & apiRECT.Right - apiRECT.Left
Print "WorkAreaHeight: " & apiRECT.Bottom - apiRECT.Top
Else
Print "Call to SystemParametersInfo failed."
End If End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货