2

我在VB6中遇到双显示器问题,请帮助我找出以下任何一个。

  1. 是否连接双显示器?
  2. 获取屏幕全宽(主屏幕+扩展监视器屏幕)

目前我正在使用 VB6 中可用的现有属性。

Screen.Width&Screen.Height它只给了我主显示器的宽度和高度。

4

1 回答 1

3

您必须使用 Windows API 来确定多显示器设置的虚拟屏幕大小:

Private Const SM_CXVIRTUALSCREEN = 78
Private Const SM_CYVIRTUALSCREEN = 79
Private Const SM_CMONITORS = 80
Private Const SM_SAMEDISPLAYFORMAT = 81

Private Declare Function GetSystemMetrics Lib "user32" ( _
   ByVal nIndex As Long) As Long

Public Property Get VirtualScreenWidth() As Long
   VirtualScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN)
End Property
Public Property Get VirtualScreenHeight() As Long
   VirtualScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN)
End Property
Public Property Get DisplayMonitorCount() As Long
   DisplayMonitorCount = GetSystemMetrics(SM_CMONITORS)
End Property
Public Property Get AllMonitorsSame() As Long
   AllMonitorsSame = GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
End Property

来自vbAccelerator.com

于 2013-11-14T13:53:06.007 回答