one or two monitors

  • Thread starter Thread starter Robert Flanagan
  • Start date Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top