View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default test for secondary monitor...

This is quite simple with the Windows API. Paste all this in a normal module
and try the Sub Test()
You can leave the other (other than SM_CMONITORS) out.


Option Explicit

Private Const SM_CXSCREEN = 0
Private Const SM_CYSCREEN = 1
Private Const SM_CYCAPTION = 4
Private Const SM_CXBORDER = 5
Private Const SM_CYBORDER = 6
Private Const SM_CXFULLSCREEN = 16
Private Const SM_CYFULLSCREEN = 17
Private Const SM_CXVIRTUALSCREEN As Long = 78
Private Const SM_CMONITORS As Long = 80

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

Function IsMultiMonitorSystem() As Boolean
'Returns True if a multi-monitor system
IsMultiMonitorSystem = GetSystemMetrics(SM_CMONITORS) 1
End Function

Function GetMonitorCount() As Long
'returns the number of display monitors
'on the desktop in a multi-monitor system
GetMonitorCount = GetSystemMetrics(SM_CMONITORS)
End Function

Sub test()

MsgBox IsMultiMonitorSystem()

End Sub


RBS

"JNW" wrote in message
...
How do I run a test to determine if there is a secondary monitor?

Thanks!
--
JNW