Gianni Posted August 22, 2020 Share Posted August 22, 2020 (edited) post edited: seems that the wrong result is also if taskbar is on the left don't know if it's me or if this is a bug. When running the script of the help file related to this functioin, the "Work area" rectangle returned (which should be the full screen area minus the space occupied by the taskbar) is wrong if the taskbar is located at the top or on the left of the screen; In fact, in that cases, it seems to return the same area for both "full rectangle" and "work area". in the other 2 cases where the taskbar is on the right or bottm the result returned seems instead correct. Edited August 22, 2020 by Chimp wrong result also if taskbar is on the left Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Deye Posted August 23, 2020 Share Posted August 23, 2020 looks to be working correctly when using SystemParametersInfo Link to comment Share on other sites More sharing options...
Gianni Posted August 23, 2020 Author Share Posted August 23, 2020 Hi @Deye, it seems to me that the same behavior also occurs with the other API calls.If you move the taskbar down or to the right of the screen then the values of the workarea are less than the area of the whole screen (Rectangle)while if the taskbar is positioned at the top or left then the workarea is equal to the value of the Rectangle., (which corresponds to the screen resolution)I think this behavior is incorrect; or am I missing something?Thank you A script to chech after moving the taskbar: #include <WinAPIGdi.au3> #include <WinAPIMisc.au3> #include <WinAPISys.au3> #include <WinAPIsysinfoConstants.au3> Local $aMonitors = _WinAPI_EnumDisplayMonitors() Local $hMonitor = $aMonitors[1][0] ; handle of the first monitor ; ------------------------------------------------- ; use _WinAPI_GetMonitorInfo to get data ; ------------------------------------------------- Local $aData = _WinAPI_GetMonitorInfo($hMonitor) If IsArray($aData) Then ConsoleWrite('Handle: ' & $hMonitor & @CRLF) ConsoleWrite(@CRLF & "Following rectangle shouldn't be (?) bigger than the below work area" & @CRLF) ConsoleWrite('Rectangle: ' & DllStructGetData($aData[0], 1) & ', ' & DllStructGetData($aData[0], 2) & ', ' & DllStructGetData($aData[0], 3) & ', ' & DllStructGetData($aData[0], 4) & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite('Work area1: ' & DllStructGetData($aData[1], 1) & ', ' & DllStructGetData($aData[1], 2) & ', ' & DllStructGetData($aData[1], 3) & ', ' & DllStructGetData($aData[1], 4) & @CRLF) ; ConsoleWrite('Primary: ' & $aData[2] & @CRLF) ; ConsoleWrite('Device name: ' & $aData[3] & @CRLF) EndIf ; ------------------------------------------------- ; use _WinAPI_GetWorkArea to get data ; ------------------------------------------------- Local $tRECT = _WinAPI_GetWorkArea() ConsoleWrite('Work area2: ' & DllStructGetData($tRECT, 1) & ', ' & DllStructGetData($tRECT, 2) & ', ' & DllStructGetData($tRECT, 3) & ', ' & DllStructGetData($tRECT, 4) & @CRLF) ; ------------------------------------------------- ; use _WinAPI_SystemParametersInfo to get Work area ; ------------------------------------------------- Local $tWorkArea = DllStructCreate($tagRECT) _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, $tWorkArea) ConsoleWrite('Work area3: ' & DllStructGetData($tWorkArea, 'Left') & ', ' & DllStructGetData($tWorkArea, 'Top') & ', ' & DllStructGetData($tWorkArea, 'Right') & ', ' & DllStructGetData($tWorkArea, 'Bottom') & @CRLF) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Gianni Posted August 23, 2020 Author Share Posted August 23, 2020 .... Wait a moment, I must be a little dazed I confused the X Y coordinates of the lower right corner with the height and width dimensions of the rectangle to get the width and height of the work area I have to subtract the X and Y coordinates .... I need double coffees. .... my apologies for the banality Musashi 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now