Перетаскивание окна
В примере реализовано перетаскивание окна не только за заголовок, как это сделано по умолчанию в системе, но и за клиентскую часть.
Кто автор, не знаю.
Код
#Define GET_WINDOW_POS (0 )
#Define SET_WINDOW_POS (100)
#Define EVENT_MOUSE_MOVE (4)
#Define EVENT_MOUSE_BUTTON_PRESS (5)
#Define EVENT_MOUSE_BUTTON_RELEASE (6)
#Define EVENT_WINDOW_CLOSE (13)
#Define TRUE (-1)
#Define FALSE (0 )
'==========================================================================|
Type Screen_Event Field = 1
code as Integer
Union
Type
scancode as Integer
ascii as Integer
End Type
Type
x as Integer
y as Integer
dx as Integer
dy as Integer
End Type
button as Integer
z as Integer
End union
End type
'==========================================================================|
ScreenRes 320, 240 , 32
Print "Use left mouse button to drag window."
Print "Use right mouse button to exit."
Dim as Screen_Event event
Dim as Integer trackMouse = FALSE, exitFlag = FALSE
Do until exitFlag
Do while ScreenEvent(@event)
Select case event.code
Case EVENT_MOUSE_BUTTON_PRESS
If event.button = 1 Then ' Left button
trackMouse = TRUE
Elseif event.button = 2 Then 'Right button
exitFlag = TRUE
End if
Case EVENT_MOUSE_BUTTON_RELEASE
If event.button = 1 Then ' Left button
trackMouse = FALSE
End if
Case EVENT_MOUSE_MOVE
If trackMouse Then
Dim as Integer wX, wY
ScreenControl GET_WINDOW_POS, wX, wY
wX += event.dx
wY += event.dy
ScreenControl SET_WINDOW_POS, wX, wY
End if
Case EVENT_WINDOW_CLOSE
exitFlag = TRUE
End select
Loop
Sleep 10
Loop