Windows Develop Bookmark and Share   
 index > Windows Forms General > SPI_SETWORKAREA
 

SPI_SETWORKAREA

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

 
JohnySeven  Thursday, August 11, 2005 4:33 PM

Try adding SPIF_SENDCHANGE

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

Abilash Sanam  Sunday, February 10, 2008 3:58 AM

Try adding SPIF_SENDCHANGE

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

Abilash Sanam  Sunday, February 10, 2008 3:58 AM

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

Glenn621  Monday, September 01, 2008 6:25 PM

The second paramter (uiParam)of SystemParametersInfo callis 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 );
roman-de  Friday, September 18, 2009 12:31 PM

You can use google to search for other answers

Custom Search

More Threads

• Referencing textboxes
• Drawing.Bitmap and Hbitmap
• need an idea... to create a "Modules Menu"
• Looping
• Horizontal Scrolling
• Delete files using CommonDialog
• Using custom Event Arguments with a System.EventHandler
• Help listbox
• Control order getting chnaged when adding control to TableLayoutPanel
• problem with dates