ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   test for secondary monitor... (https://www.excelbanter.com/excel-programming/372507-test-secondary-monitor.html)

JNW

test for secondary monitor...
 
How do I run a test to determine if there is a secondary monitor?

Thanks!
--
JNW

RB Smissaert

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



JNW

test for secondary monitor...
 
Thank you. I've searched far and wide for this.

When you said "You can leave the others out" did you mean the Lines
containing SM_CXSCREEN through SM_CXVIRTUALSCREEN?

Thanks again!

--
JNW


"RB Smissaert" wrote:

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




RB Smissaert

test for secondary monitor...
 
Yes, those constants are not used in this bit of code, but you may want them
for other purposes.

RBS

"JNW" wrote in message
...
Thank you. I've searched far and wide for this.

When you said "You can leave the others out" did you mean the Lines
containing SM_CXSCREEN through SM_CXVIRTUALSCREEN?

Thanks again!

--
JNW


"RB Smissaert" wrote:

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





JNW

test for secondary monitor...
 
Thanks again!
--
JNW


"RB Smissaert" wrote:

Yes, those constants are not used in this bit of code, but you may want them
for other purposes.

RBS

"JNW" wrote in message
...
Thank you. I've searched far and wide for this.

When you said "You can leave the others out" did you mean the Lines
containing SM_CXSCREEN through SM_CXVIRTUALSCREEN?

Thanks again!

--
JNW


"RB Smissaert" wrote:

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






All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com