如何获得双显示器或获得全宽度,包括VB6中的双显示器

时间:2013-11-14 11:29:39

标签: vb6 multiple-monitors

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

  1. 是否连接双显示器?
  2. 获取全屏宽度(主屏幕+扩展显示屏)
  3. 目前我正在使用VB6中现有的属性。

    Screen.Width& Screen.Height只给出了主监视器的宽度和高度。

1 个答案:

答案 0 :(得分: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