Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default test for secondary monitor...

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

Thanks!
--
JNW
  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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




  #5   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Monitor ? Microsoft Communities Excel Discussion (Misc queries) 2 June 26th 09 07:13 PM
Calculate mean of test scores from rows of test answers RiotLoadTime Excel Discussion (Misc queries) 1 July 26th 06 05:14 PM
clipboard monitor climax[_4_] Excel Programming 1 July 21st 06 06:55 PM
Monitor Changes Tempy Excel Programming 0 September 30th 05 04:10 PM


All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"