Sticky Window
Posted: Sun Aug 24, 2003 4:29 am
I made a little proc in order to 'stick' your window to the screen borders.
Just like a WinAmp window do...
Run the example, and move it to the border of your desktop and look at the behavior...
if anyone has idea to enhance it, tell me here 
Just like a WinAmp window do...
Run the example, and move it to the border of your desktop and look at the behavior...
Code: Select all
#SPACE = 16
;-- Procedure StickyWindow --
Procedure StickyWindow( hWnd.l, Event.l, wParam.l, lParam.l )
If Event = #WM_WINDOWPOSCHANGED
SystemParametersInfo_( #SPI_GETWORKAREA, 0, @scrRect.RECT, 0)
scrW = scrRect\right - scrRect\left
scrH = scrRect\bottom - scrRect\top
GetWindowRect_( WindowID(), @wndRect.RECT )
wndW = wndRect\right - wndRect\left
wndH = wndRect\bottom - wndRect\top
If wndRect\left < #SPACE : wndRect\left = 0 : EndIf
If wndRect\top < #SPACE : wndRect\top = 0 : EndIf
If scrW-wndRect\right < #SPACE : wndRect\left = scrW-wndW : EndIf
If scrH-wndRect\bottom < #SPACE : wndRect\top = scrH-wndH : EndIf
MoveWindow( wndRect\left, wndRect\top )
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
;-- Boucle Principale --
If OpenWindow( 0, 200, 200, 300, 100, #PB_Window_SystemMenu, "Sticky Window" )
SetWindowCallback( @StickyWindow() )
While WaitWindowEvent() <> #WM_CLOSE : Wend
EndIf
;-- Fin --
End