Basic Univers
; Permet de gérer la vitesse de déplacement du curseur de la souris


Procedure GetMouseSpeed()
    If SystemParametersInfo_(#SPI_GETMOUSESPEED, 0, @l, 0)
        ProcedureReturn l
    EndIf
EndProcedure

Procedure SetMouseSpeed(Speed)
ProcedureReturn  SystemParametersInfo_(#SPI_SETMOUSESPEED, 0, Speed, #SPIF_UPDATEINIFILE | #SPIF_SENDWININICHANGE)
EndProcedure

win = OpenWindow(#PB_Any, 0, 0, 170, 70, "MouseSpeed", #PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_MinimizeGadget)
If win And CreateGadgetList(WindowID(win))
    Speed = GetMouseSpeed()
    TextGadget(0, 10, 10, 60, 20, "Speed : " + Str(Speed))
    TrackBarGadget(1, 80, 10, 80, 20, 1, 20)
    SetGadgetState(1, Speed)
    ButtonGadget(2, 100, 40, 60, 20, "Appliquer")
    Repeat
        Select WaitWindowEvent()
            Case #PB_Event_Gadget
                Select EventGadget()
                    Case 1
                        SetGadgetText(0, "Speed : " + Str(GetGadgetState(1)))
                    Case 2
                        SetMouseSpeed(GetGadgetState(1))
                EndSelect
            Case #PB_Event_CloseWindow
                Quit = 1
        EndSelect
    Until Quit = 1
EndIf