Hi I have some code I use to move a form to a third monitor (if one exists) and everything works correctly except the math calculations based on screen size.
intMoveX = 86000
So the code that moves to the 2nd monitor works similarly but the 3rd has a math issue of some sort
if I have 3 monitors and the values of the lefts are all 3 are HD 1920*1080:
So I started just hard coding values intMoveX to 70000 / 60000 / 50000 and they all work to move the form to the 3rd monitor but obviously i can't just fudge it like that at run time, users have all kinds of different resolutions, can anyone shed light on why this could be happening or a strategry to deal with it? Im running up against HD 4K etc and i have no idea what the resolution will be.
What am I missing here? for a quick hack that TOTALLY SUCKS i changed the twip calc to intMoveX = intMoveX * 10 but that only works in specific cases like this one, I need to udnerstand why the math doens't work here. So the final wrinkle comes in when i have laptop display + usb display + usb display, that works with this intMoveX * 10 hack. but if i close the lid on my laptop and use HDMI out + usb display + usb display only the intMoveX * 15 works. Tried multiple laptops same behavior. AT this point im about to add a global variable called 3rdMontiorVariance and let the user set it, but how stupid is that, there must be a better way.
Thanks!
David
intMoveX = 86000
Code:
If GetMonitorId > 2 Then 'move to monitor 3 and maximize! (getmonitorid also populates the monitorid array public var of all monitor strings
FirstMonitorLeft = ReturnLeftForMonitor(MonitorID(1))
SecondMonitorLeft = ReturnLeftForMonitor(MonitorID(2))
ThirdMonitorLeft = ReturnLeftForMonitor(MonitorID(3))
ReDim aryDisplays(2) '3 monitors
aryDisplays(0) = FirstMonitorLeft
aryDisplays(1) = SecondMonitorLeft
aryDisplays(2) = ThirdMonitorLeft
SortArray aryDisplays ' sort array sizes ascending no matter how windows has these monitors identity
intMoveX = aryDisplays(2) 'use third monitor
intMoveX = intMoveX * 15 '15 twips per pixel I was told
intMoveY = 100
Forms![frmScoreboard-Audience2].Form.SetFocus
Forms![frmScoreboard-Audience2].Form.Move intMoveX, intMoveY
DoCmd.Maximize
So the code that moves to the 2nd monitor works similarly but the 3rd has a math issue of some sort
if I have 3 monitors and the values of the lefts are all 3 are HD 1920*1080:
Code:
'return values for simplicity sake
FirstMonitorLeft =0
SecondMonitorLeft = 2880
ThirdMonitorLeft = 5760
intMoveX = aryDisplays(2) 'use third monitor 'ThirdMonitorLeft
intMoveX = intMoveX * 15 ' this is 86000
Forms![frmScoreboard-Audience2].Form.Move intMoveX, intMoveY 'FAILS (apparently 86000 is off my screen so it goes back to screen 1)
So I started just hard coding values intMoveX to 70000 / 60000 / 50000 and they all work to move the form to the 3rd monitor but obviously i can't just fudge it like that at run time, users have all kinds of different resolutions, can anyone shed light on why this could be happening or a strategry to deal with it? Im running up against HD 4K etc and i have no idea what the resolution will be.
What am I missing here? for a quick hack that TOTALLY SUCKS i changed the twip calc to intMoveX = intMoveX * 10 but that only works in specific cases like this one, I need to udnerstand why the math doens't work here. So the final wrinkle comes in when i have laptop display + usb display + usb display, that works with this intMoveX * 10 hack. but if i close the lid on my laptop and use HDMI out + usb display + usb display only the intMoveX * 15 works. Tried multiple laptops same behavior. AT this point im about to add a global variable called 3rdMontiorVariance and let the user set it, but how stupid is that, there must be a better way.
Thanks!
David
Last edited: