que j'ai trouvé en tapant "déplacer fenêtre" dans les recherches.
Voilà un code complet de Rashad.
Code : Tout sélectionner
;rashad
#MONITORINFOF_PRIMARY=1
#MONITOR_DEFAULTTONULL=0
#MONITOR_DEFAULTTOPRIMARY=1
#MONITOR_DEFAULTTONEAREST=2
#SC_Leftsize = $F001
#SC_Rightsize = $F002
#SC_Upsize = $F003
#SC_UpLeftsize = $F004
#SC_UpRightsize = $F005
#SC_Dnsize = $F006
#SC_DnLeftsize = $F007
#SC_DnRightsize = $F008
#SC_DragMove = $F012
; CompilerIf #PB_Compiler_Unicode = 0
; MessageRequester("Info","Unicode compiler option not set",#MB_ICONINFORMATION)
; End
; CompilerEndIf
Global hwnd,r.RECT,hmon,mi.MONITORINFO,x,y,w,h,snap
mi\cbSize=SizeOf(mi)
Procedure sizeCB()
ResizeGadget(0,10,WindowHeight(0)-36,60,24)
EndProcedure
hwnd=OpenWindow(0,0,0,800,600,"PB_Player",#PB_Window_BorderLess | #WS_BORDER | #PB_Window_Invisible)
SetWindowColor(0,$838383)
ButtonGadget(0,10,564,60,24,"Quit")
HideWindow(0,0,#PB_Window_ScreenCentered)
BindEvent(#PB_Event_SizeWindow,@sizeCB())
SmartWindowRefresh(0,1)
snap = 50
sw = 10
sww = 2*sw
Repeat
Select WaitWindowEvent(1)
Case #PB_Event_MoveWindow
If IsWindow(0)
GetWindowRect_(hWnd,r)
w = r\right - r\left
h = r\bottom - r\top
EndIf
hmon = MonitorFromWindow_(hWnd,#MONITOR_DEFAULTTONEAREST)
GetMonitorInfo_(hmon,mi)
If mi\rcWork\left + snap > r\left : r\left = mi\rcWork\left - 2: EndIf
If r\left + w >= (mi\rcWork\right - snap): r\left = mi\rcWork\right - w + 2: EndIf
If mi\rcWork\top + snap > r\top : r\top = mi\rcWork\top - 2 : EndIf
If r\top + h >= (mi\rcWork\bottom - snap): r\top = mi\rcWork\bottom - h + 2 : EndIf
MoveWindow_(hWnd,r\left,r\top,w,h,1)
Case #WM_MOUSEMOVE;,#WM_NCMOUSEMOVE
GetWindowRect_(hWnd,r.RECT)
mx = DesktopMouseX()
my = DesktopMouseY()
Flag = 0
If mx > r\left+sww And mx < r\right-sww And my > r\top-sw And my < r\top+sw
SetCursor_(LoadCursor_(0, #IDC_SIZENS))
Flag = 1
ElseIf mx > r\left+sww And mx < r\right-sww And my > r\bottom-sw And my < r\bottom+sw
SetCursor_(LoadCursor_(0, #IDC_SIZENS))
Flag = 2
ElseIf mx > r\left-sw And mx < r\left+sw And my > r\top+sww And my < r\bottom-sww
SetCursor_(LoadCursor_(0, #IDC_SIZEWE))
Flag = 3
ElseIf mx > r\right-sw And mx < r\right+sw And my > r\top+sww And my < r\bottom-sww
SetCursor_(LoadCursor_(0, #IDC_SIZEWE))
Flag = 4
ElseIf mx > r\left-sw And mx < r\left+sw And my > r\top-sw And my < r\top+sw
SetCursor_(LoadCursor_(0, #IDC_SIZENWSE))
Flag = 5
ElseIf mx > r\right-sw And mx < r\right+sw And my > r\bottom-sw And my < r\bottom+sww
SetCursor_(LoadCursor_(0, #IDC_SIZENWSE))
Flag = 6
ElseIf mx > r\right-sw And mx < r\right+sw And my > r\top-sw And my < r\top+sw
SetCursor_(LoadCursor_(0, #IDC_SIZENESW))
Flag = 7
ElseIf mx > r\left-sw And mx < r\left+sw And my > r\bottom-sw And my < r\bottom+sww
SetCursor_(LoadCursor_(0, #IDC_SIZENESW))
Flag = 8
EndIf
Case #WM_LBUTTONDOWN
If Flag > 0
ReleaseCapture_()
EndIf
If Flag = 0
SetCursor_(LoadCursor_(0, #IDC_HAND))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_DragMove,0)
ElseIf Flag = 1
SetCursor_(LoadCursor_(0, #IDC_SIZENS))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_Upsize,0)
ElseIf Flag = 2
SetCursor_(LoadCursor_(0, #IDC_SIZENS))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_Dnsize,0)
ElseIf Flag = 3
SetCursor_(LoadCursor_(0, #IDC_SIZEWE))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_Leftsize,0)
ElseIf Flag = 4
SetCursor_(LoadCursor_(0, #IDC_SIZEWE))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_Rightsize,0)
ElseIf Flag = 5
SetCursor_(LoadCursor_(0, #IDC_SIZENWSE))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_UpLeftsize,0)
ElseIf Flag = 6
SetCursor_(LoadCursor_(0, #IDC_SIZENWSE))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_DnRightsize,0)
ElseIf Flag = 7
SetCursor_(LoadCursor_(0, #IDC_SIZENESW))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_UpRightsize,0)
ElseIf Flag = 8
SetCursor_(LoadCursor_(0, #IDC_SIZENESW))
SendMessage_(hWnd, #WM_SYSCOMMAND , #SC_DnLeftsize,0)
EndIf
Case #WM_LBUTTONUP
Flag = 0
SendMessage_(hWnd, #WM_SYSCOMMAND, 0, 0)
Case #PB_Event_Gadget
Select EventGadget()
Case 0
Quit = 1
EndSelect
EndSelect
Until Quit = 1