VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Snap you app to the side of the screen (like ICQ does.. Resizing desktop.. not just moving the form)

SKoW  (11 Submissions)   Windows API Call/Explanation   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

This code uses the SystemParametersInfo API to change the work space area of the desktop. You can make you app 'lock' to either top/bottom/left or right of the screen very simply.

Side Effects
This example does not move all the other windows like ICQ does, they will change when you maximize them but I think the only other way to do it would be to do a EnumWindows then send WM_MOVE to each window visible.. I think that is how ICQ moves all the windows out of the way

API Declarations
Private Declare Function SystemParametersInfo Lib "user32.dll" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uiParam As Long, pvParam As Any, ByVal fWinIni As Long) As Long
Enum DockTypes
DockLeft = 1
DockTop = 2
DockRight = 3
DockBottom = 4
End Enum
Private Type vbRECT ' use this to save old Window Positions
vbLeft As Long
vbTop As Long
vbWidth As Long
vbHeight As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const SPIF_SENDWININICHANGE = &H2
Private Const SPI_GETWORKAREA = 48
Private Const SPI_SETWORKAREA = 47

Private vbFormOldRect As vbRECT
Private LastDock As DockTypes
Private DockAmount As Integer

Rate Snap you app to the side of the screen (like ICQ does.. Resizing desktop.. not just moving the form) (5(5 Vote))
Snap you app to the side of the screen (like ICQ does.. Resizing desktop.. not just moving the form).bas

Snap you app to the side of the screen (like ICQ does.. Resizing desktop.. not just moving the form) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters