Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #9402

Re: Size of Access windows on dual monitors

From "Phil" <phil@stantonfamily.co.uk>
Newsgroups comp.databases.ms-access
Subject Re: Size of Access windows on dual monitors
Date 2014-05-15 22:42 +0100
Organization Aioe.org NNTP Server
Message-ID <ll3cce$nqb$1@speranza.aioe.org> (permalink)
References <ll0a8g$rid$1@speranza.aioe.org> <4c775000-4d71-46a6-a299-e7eb85866aa4@googlegroups.com>

Show all headers | View raw


On 14/05/2014 21:56:26, Patrick Finucane wrote:
> On Wednesday, May 14, 2014 12:47:58 PM UTC-5, Phil wrote:
>> I have a dual monitor setup. And I want to get the size of the Access win
> dow so that I can play around with form sizes & positions. Sorry, this is
> a bit longwinded. Option Compare Database Option Explicit Private Type
> Rect Left As Long Top As Long Right As Long Bottom As Long End Type
> Private vate Declare Function GetWindowRect Lib "user32" (ByVal hWnd As
> Long, lpRect As Rect) As Long Private Declare Function MonitorFromWindow
> Lib "User32.dll" _ (ByVal hWnd As Long, ByVal dwFlags As Long) As Long
> Private Declare Funct ion GetMonitorInfo Lib "User32.dll" Alias
> "GetMonitorInfoW" _ (ByVal hMonit or As Long, ByVal lpMonitorInfo As Long)
> As Long Dim AreaHeight As Integer Dim AreaWidth As Integer Sub
> GetAccessWindowSize() Dim Rec As Rect GetWindo wRect
> Application.hWndAccessApp, Rec AreaHeight = Rec.Bottom AreaWidth =
> Rec.Right End Sub This gets the Size of the Access Window (AreaWidth &
> AreaHeight) OK on my right hand monitor and for a maximised Access window
> I get a size of 1928 * 1058. Odd as the correct resolution should be 1920
> * 1080 but the difference in height may be something to do with the
> Windows T ask bar). If I drag Access over to the left hand monitor (it's a
> bit narrow er) I get maximizes Access window of 8 * 1058 Again Odd as the
> resolution s hould be 1680*1050: There is no taskbar on this monitor) So
> it appears that the GetWindowRect overestimates both width & height by 8,
> which can easily be compensated for. Sub MonitorDetails() Dim hMonitor As
> Long Dim MonitorI nfo As typMonitorInfo Dim apiReturnCode As Long hMonitor
> = MonitorFromWin dow(Application.hWndAccessApp, &H0&) MonitorInfo.cbSize =
> LenB(MonitorInf o) apiReturnCode = GetMonitorInfo(hMonitor,
> VarPtr(MonitorInfo)) With Mon itorInfo.rcMonitor Debug.Print "Horizontal
> resolution: " & .Right - .Left D ebug.Print "Vertical resolution: " &
> .Bottom - .Top Debug.Print Debug.Print "Form Left: " & Me.WindowLeft & "
> Form width: " & Me.WindowWidth End With End Sub This returns the
> resolutions correctly as either 1920 * 1080 or 168 0 * 1050 depending on
> which monitor the form gets opened on. So what I want is to get the
> correct width of the Access Window on the smaller left hand screen. Any
> ideas please? Phil --- This email is free from viruses and malw are
> because avast! Antivirus protection is active. http://www.avast.com I saw
> some API functions; EnumDisplayMonitors and GetMonitorInfo, but the f
> unctions were written in c++. not vba. Somehow you need the hwnd value for
> each monitor. Wish I could help.
> 

Thanks Patrick

I have an enormouse API database probably about 500 APIs with parameters,
notes and most importantly examples all written in VBA Have found some
examples on monitors and will ltake it from there

Phil

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Size of Access windows on dual monitors "Phil" <phil@stantonfamily.co.uk> - 2014-05-14 18:47 +0100
  Re: Size of Access windows on dual monitors Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-05-14 13:56 -0700
    Re: Size of Access windows on dual monitors "Phil" <phil@stantonfamily.co.uk> - 2014-05-15 22:42 +0100
      Re: Size of Access windows on dual monitors DFS <nospam@dfs.com> - 2014-05-15 23:33 -0400
        Re: Size of Access windows on dual monitors "Phil" <phil@stantonfamily.co.uk> - 2014-05-16 08:09 +0100
  Re: Size of Access windows on dual monitors Ulrich Möller <knobbi38@usenet.arcornews.de> - 2014-05-16 12:02 +0200

csiph-web