none
SPI_SETWORKAREA

    Question

  • Hello,

    I have problem with setting work area of desktop. I use SystemParametersInfo call with argument SPI_SETWORKAREA(See my code below). After call the working area is changed, but system don't notify any window about this change. Can any one help me with solution of this problem ? Thanks for any help. John



    Class WorkArea

    #Region "API Structure"

    Public Structure RECT

       Public Left As Integer

       Public Top As Integer

       Public Right As Integer

       Public Bottom As Integer

    End Structure

    #End Region

    #Region "API Declares"

    Private Declare Function SystemParametersInfo Lib "User32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Short, ByVal uparam As Short, ByRef lpvParam As RECT, ByVal fuWinIni As Short) As Short

    Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Integer) As Integer

    #End Region

    #Region "API Constants"

    Private
    Const HWND_BROADCAST As Integer = &HFFFF

    Private Const WM_SETTINGCHANGE As Integer = &H1A

    Private Const SMTO_ABORTIFHUNG As Integer = &H2

    Const SPI_SETWORKAREA As Short = 47

    #End Region

    Public Sub SetWorkArea(ByVal rect As RECT)

    SystemParametersInfo(SPI_SETWORKAREA, 0, rect, 0)

    Dim r As Integer

    SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, SPI_SETWORKAREA, 0, SMTO_ABORTIFHUNG, 100000, r)

    End Sub


    End Class

     
    Thursday, August 11, 2005 4:33 PM

Answers

  • Try adding SPIF_SENDCHANGE

    SystemParametersInfo( SPI_SETWORKAREA, 0, (VOID *)rect, SPIF_SENDCHANGE)

     

    Sunday, February 10, 2008 3:58 AM

All replies

  • Try adding SPIF_SENDCHANGE

    SystemParametersInfo( SPI_SETWORKAREA, 0, (VOID *)rect, SPIF_SENDCHANGE)

     

    Sunday, February 10, 2008 3:58 AM
  •  

    However, the statement still cannot resize top-level windows.

    Monday, September 01, 2008 6:25 PM
  • The second paramter (uiParam) of SystemParametersInfo call is the important thing.
    MSDN does not mention it together with SPI_SETWORKAREA :-( 

    Following code works fine for me:

     

    SystemParametersInfo( SPI_SETWORKAREA, 1, &NewRect, SPIF_SENDCHANGE );
    Friday, September 18, 2009 12:31 PM