I want to implement the access form to get the left right top bottom of the second screen through the window api for the calculation of the appbar when change scale display, but when I use Microsoft Access Runtime 2013 "GetMonitorInfo" to get the value of the current screen, the result is completely different from Microsoft Access. Is this normal? Is this the affect by the structure of Microsoft Access runtime? Why is it still affected by Microsoft Access runtime and Microsoft Access when using the window api directly?
Code
' 1.) Get current monitor hwnd from current form position
lngCurrentMonitorHWnd = MonitorFromWindow(frmAccessForm.hwnd, MONITOR_DEFAULTTONULL)
' 2) Get current monitor info and logical size
objCurrentMonitorInfo.cbSize = Len(objCurrentMonitorInfo)
Call GetMonitorInfo(lngCurrentMonitorHWnd, objCurrentMonitorInfo)
' 3) Set current monitor info variable value
mlngCurrentScreenLeft = objCurrentMonitorInfo.rcMonitor.Left
mlngCurrentScreenRight = objCurrentMonitorInfo.rcMonitor.Right
mlngCurrentScreenTop = objCurrentMonitorInfo.rcMonitor.Top
mlngCurrentScreenBottom = objCurrentMonitorInfo.rcMonitor.Bottom
Result of Microsoft Access 365/2019/2016/2013
100%
125%
Result of Microsoft Access Runtime 2013
100%
125%
Ways I've tried
- Change MonitorFromWindow window handle property to window native file explorer (get by api-sam.exe), by pass acees hwnd to get monitor hwnd. but result still different in Microsoft Office runtime 2013
' 1.) Get current monitor hwnd from current form position
lngCurrentMonitorHWnd = MonitorFromWindow(69911, MONITOR_DEFAULTTONULL)
' 2) Get current monitor info and logical size
objCurrentMonitorInfo.cbSize = Len(objCurrentMonitorInfo)
Call GetMonitorInfo(lngCurrentMonitorHWnd, objCurrentMonitorInfo)
2.Change way to get monitor hwnd,use MonitorFromPoint to get current screen hwnd,but result still different in Microsoft Office runtime 2013.
' 1.) Get current monitor hwnd from current mouse position
GetCursorPos objMousePoint
lngCurrentMonitorHWnd = MonitorFromPoint(objMousePoint.x, objMousePoint.y,MONITOR_DEFAULTTOPRIMARY)
' 2) Get current monitor info and logical size
objCurrentMonitorInfo.cbSize = Len(objCurrentMonitorInfo)
Call GetMonitorInfo(lngCurrentMonitorHWnd, objCurrentMonitorInfo)