Jump to content

Search the Community

Showing results for tags 'SPI_SETWORKAREA'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 1 result

  1. Hello one and all. I am creating a toolbar which reserves 40 pixels of the right-hand side of the screen by updating the "Desktop Work Area" via _WinAPI_SystemParametersInfo, so windows maximize up to it, much like the old Office Toolbar. All worked great, new windows would maximize up to the new border, but existing maximized windows were a problem. Initially I created a slightly noddy function utilising a combination of WinList and WinMove to find any visible maximized windows and adjust them accordingly. While this worked ok, I didn't like it as it felt a bit, well, noddy. I then discovered the 4th parameter of _WinAPI_SystemParametersInfo to send a WM_SETTINGCHANGE message after updating the work area which caused all maximized windows to instantly jump to their new position - great! The Windows API was working for me - I could do away with my noddy function. The trouble I face, however, is that on exit, while I set the work area back to the full width of the desktop, maximized windows aren't taking up the new larger area, unless manually restored down and maximized again. With a bit of experimenting, I've discovered that using this method, maximized windows only respond to the message if the work area is reduced, not increased. I created a little GUI which plays around with this very phenomenon; #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <StaticConstants.au3> #include <StructureConstants.au3> #include <WinAPI.au3> Global $iLeft, $iTop, $iRight, $iBottom ; Create the GUI GUICreate("WorkArea", 210, 200) GUICtrlCreateLabel("Pixel Amount:", 10, 10, 90, 20, $SS_RIGHT) $Input = GUICtrlCreateInput("40", 110, 8, 90, 20) $Reduce = GUICtrlCreateButton("Reduce", 10, 40, 90, 30) $Increase = GUICtrlCreateButton("Increase", 110, 40, 90, 30) $Reset = GUICtrlCreateButton("Reset", 10, 80, 190, 30) $ListView = GUICtrlCreateListView("Left|Top|Right|Bottom", 10, 120, 190, 50) $WorkArea = GUICtrlCreateListViewItem("", $ListView) _GUICtrlListView_SetColumnWidth($ListView, 0, 33) _GUICtrlListView_SetColumnWidth($ListView, 1, 33) _GUICtrlListView_SetColumnWidth($ListView, 2, 60) _GUICtrlListView_SetColumnWidth($ListView, 3, 60) GUISetState(@SW_SHOW) _GetDesktopWorkArea($iLeft, $iTop, $iRight, $iBottom) ; Loop until message received While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ; Reset the work area to Desktop Width then close _SetDesktopWorkArea($iLeft, $iTop, @DesktopWidth, $iBottom) ExitLoop Case $msg = $Reduce ; Reduce the work area width by the amount in input box $Pixels = GUICtrlRead($Input) _SetDesktopWorkArea($iLeft, $iTop, $iRight-$Pixels, $iBottom) _GetDesktopWorkArea($iLeft, $iTop, $iRight, $iBottom) Case $msg = $Increase ; Increase the work area width by the amount in input box $Pixels = GUICtrlRead($Input) _SetDesktopWorkArea($iLeft, $iTop, $iRight+$Pixels, $iBottom) _GetDesktopWorkArea($iLeft, $iTop, $iRight, $iBottom) Case $msg = $Reset ; Reset the work area to Desktop Width _SetDesktopWorkArea($iLeft, $iTop, @DesktopWidth, $iBottom) _GetDesktopWorkArea($iLeft, $iTop, $iRight, $iBottom) EndSelect WEnd Func _GetDesktopWorkArea(ByRef $iLeft, ByRef $iTop, ByRef $iRight, ByRef $iBottom) Local Const $SPI_GETWORKAREA = 48 Local $tStruct = DllStructCreate($tagRECT) If _WinAPI_SystemParametersInfo($SPI_GETWORKAREA, 0, DllStructGetPtr($tStruct)) Then $iLeft = DllStructGetData($tStruct, "Left") $iRight = DllStructGetData($tStruct, "Right") $iTop = DllStructGetData($tStruct, "Top") $iBottom = DllStructGetData($tStruct, "Bottom") GUICtrlSetData($WorkArea, $iLeft&"|"&$iTop&"|"&$iRight&"|"&$iBottom) Return True EndIf Return False EndFunc ;==>_GetDesktopWorkArea Func _SetDesktopWorkArea($iLeft, $iTop, $iRight, $iBottom) Local Const $SPI_SETWORKAREA = 47 Local Const $SPIF_SENDWININICHANGE = 0x2 Local $tStruct = DllStructCreate($tagRECT) DllStructSetData($tStruct, "Left", $iLeft) DllStructSetData($tStruct, "Right", $iRight) DllStructSetData($tStruct, "Top", $iTop) DllStructSetData($tStruct, "Bottom", $iBottom) If _WinAPI_SystemParametersInfo($SPI_SETWORKAREA, 0, DllStructGetPtr($tStruct), $SPIF_SENDWININICHANGE) Then Return True EndIf Return False EndFunc ;==>_SetDesktopWorkArea Would anyone know why this might be, and indeed if it's possible with another API call to have maximized windows respond in the same way regardless of work area reduction or enlargement? I'm loathe to go back to the noddy function! Many thanks in advance. Valiante. SetDesktopWorkArea.au3
  • Create New...