Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default one or two monitors

Is there any way to determine if a user is using two monitors?

Bob Flanagan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default one or two monitors

Yes. I finally got it to work with this webpage

http://www.xtremevbtalk.com/showthread.php?t=289231

Const MONITOR_DEFAULTTONULL As Long = 0
Const MONITOR_DEFAULTTOPRIMARY As Long = 1
Const MONITOR_DEFAULTTONEAREST As Long = 2

Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type

Type LPMONITORINFO
cbSize As Double
rcMonitor As RECT
rcWork As RECT
dwflags As Long
End Type


Private Declare Function GetNumberOfPhysicalMonitorsFromHMONITOR Lib
"dxva2.dll" _
(ByVal hmonitor As Long, ByRef pdwNumberOfPhysicalMonitors As
LPMONITORINFO) As Long

Private Declare Function MonitorFromWindow Lib "user32.dll" _
(ByVal hWind As Long, ByVal dwflags As Long) As Long


Sub test()
Dim hWind As Long
Dim hmonitor As Long
Dim flags As Long

Dim monInfo As LPMONITORINFO
hWind = Application.hwnd

A = Len(hWind)
flags = MONITOR_DEFAULTTOPRIMARY
monInfo.cbSize = Len(monInfo)

hmonitor = MonitorFromWindow(hWind, flags)

NumMonitors = GetNumberOfPhysicalMonitorsFromHMONITOR(hmonitor, monInfo)



End Sub




"Robert Flanagan" wrote:

Is there any way to determine if a user is using two monitors?

Bob Flanagan



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
Dual monitors GerryK Excel Discussion (Misc queries) 10 July 9th 08 09:58 PM
Two Monitors Mike H. Excel Programming 1 June 23rd 08 05:38 PM
2 monitors StuBela Setting up and Configuration of Excel 5 March 9th 07 10:17 AM
2 monitors - Excel 97 CH Excel Discussion (Misc queries) 6 September 19th 06 09:33 PM
Using Two Monitors Al Excel Programming 0 November 14th 05 02:35 PM


All times are GMT +1. The time now is 09:27 AM.

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"